forked from cory/tildefriends
		
	There, I can wait for a thing in a shadow root like I want.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4378 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		| @@ -14,6 +14,9 @@ for path in ('out/selenium.sqlite', 'out/selenium.sqlite-shm', 'out/selenium.sql | |||||||
| 		pass | 		pass | ||||||
| tf = subprocess.Popen(['out/debug/tildefriends', 'run', '-d', 'out/selenium.sqlite', '-b', '0', '-p', '8888']) | tf = subprocess.Popen(['out/debug/tildefriends', 'run', '-d', 'out/selenium.sqlite', '-b', '0', '-p', '8888']) | ||||||
|  |  | ||||||
|  | def exists_in_shadow_root(shadow_root, by, value): | ||||||
|  | 	return lambda driver: shadow_root.find_element(by, value) | ||||||
|  |  | ||||||
| try: | try: | ||||||
| 	options = webdriver.FirefoxOptions() | 	options = webdriver.FirefoxOptions() | ||||||
| 	#options.add_argument('--headless') | 	#options.add_argument('--headless') | ||||||
| @@ -27,23 +30,15 @@ try: | |||||||
| 	driver.find_element(By.ID, 'loginButton').click() | 	driver.find_element(By.ID, 'loginButton').click() | ||||||
|  |  | ||||||
| 	driver.switch_to.frame(driver.find_element(By.ID, 'document')) | 	driver.switch_to.frame(driver.find_element(By.ID, 'document')) | ||||||
| 	WebDriverWait(driver, 30).until(expected_conditions.presence_of_element_located((By.LINK_TEXT, 'ssb'))) | 	WebDriverWait(driver, 30).until(expected_conditions.presence_of_element_located((By.LINK_TEXT, 'ssb'))).click() | ||||||
| 	driver.find_element(By.LINK_TEXT, 'ssb').click() |  | ||||||
| 	driver.switch_to.default_content() | 	driver.switch_to.default_content() | ||||||
|  |  | ||||||
| 	WebDriverWait(driver, 30).until(expected_conditions.presence_of_element_located((By.ID, 'document'))) | 	driver.switch_to.frame(WebDriverWait(driver, 30).until(expected_conditions.presence_of_element_located((By.ID, 'document')))) | ||||||
| 	driver.switch_to.frame(driver.find_element(By.ID, 'document')) | 	tf_app = WebDriverWait(driver, 30).until(expected_conditions.presence_of_element_located((By.TAG_NAME, 'tf-app'))).shadow_root | ||||||
| 	WebDriverWait(driver, 30).until(expected_conditions.presence_of_element_located((By.TAG_NAME, 'tf-app'))) | 	WebDriverWait(driver, 30).until(expected_conditions.element_to_be_clickable(tf_app.find_element(By.ID, 'create_identity'))).click() | ||||||
| 	tf_app = driver.find_element(By.TAG_NAME, 'tf-app').shadow_root | 	WebDriverWait(driver, 30).until(expected_conditions.alert_is_present()).accept() | ||||||
| 	WebDriverWait(driver, 30).until(expected_conditions.element_to_be_clickable(tf_app.find_element(By.ID, 'create_identity'))) |  | ||||||
| 	tf_app.find_element(By.ID, 'create_identity').click() |  | ||||||
| 	alert = WebDriverWait(driver, 30).until(expected_conditions.alert_is_present()) |  | ||||||
| 	alert.accept() |  | ||||||
|  |  | ||||||
| 	driver.implicitly_wait(3) | 	tf_tab_news = WebDriverWait(driver, 30).until(exists_in_shadow_root(tf_app, By.ID, 'tf-tab-news')).shadow_root | ||||||
| 	#tf_app = driver.find_element(By.TAG_NAME, 'tf-app').shadow_root |  | ||||||
| 	#WebDriverWait(driver, 30).until(expected_conditions.visibility_of(tf_app.find_element(By.ID, 'tf-tab-news'))) |  | ||||||
| 	tf_tab_news = tf_app.find_element(By.ID, 'tf-tab-news').shadow_root |  | ||||||
| 	tf_tab_news.find_element(By.ID, 'tf-compose').shadow_root.find_element(By.ID, 'edit').send_keys('Hello, world!') | 	tf_tab_news.find_element(By.ID, 'tf-compose').shadow_root.find_element(By.ID, 'edit').send_keys('Hello, world!') | ||||||
| 	tf_tab_news.find_element(By.ID, 'tf-compose').shadow_root.find_element(By.ID, 'submit').click() | 	tf_tab_news.find_element(By.ID, 'tf-compose').shadow_root.find_element(By.ID, 'submit').click() | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user