Selenium with Python - Wait indefinitely until an input box is present -
i want webdriver instance monitor page indefinitely until input box appears name 'move.' once input box appears, want fill text , click submit button adjacent form. easiest way this?
i have now:
try: move = webdriverwait(driver, 1000).until( ec.presence_of_element_located((by.name, "move")) ) finally: wd.quit()
and button adjacent form has no name or id, locating xpath. want wait until form present before click button.
how do this?
monitor page indefinitely until input box appears
an explicit wait you've used in example requires timeout value defined. either set high value timeout, or not option.
alternatively, can have while true
loop until element found:
from selenium.common.exceptions import nosuchelementexception while true: try: form = driver.find_element_by_name("move") break except nosuchelementexception: continue button = form.find_element_by_xpath("following-sibling::button") button.click()
where i'm assuming button
element following sibling of form.
Comments
Post a Comment