Answer the question
In order to leave comments, you need to log in
How to implement popup element access using Selenium?
The site page has a form and a button.
After filling out the form and clicking on the button, a pop-up window appears with another button. This updates the DOM to include the popup code.
Can you please tell me how to click on a button in a pop-up window using Selenium?
Looking ahead, tried (Python code):
1)
WebDriverWait(driver, 10);
driver.find_element_by_xpath("//div[@id='nameId']/div/div[2]").click();
selenium.common.exceptions.NoSuchElementException: Message: 'Unable to locate
element: {"method":"xpath","selector":"//div[@id=\'nameId\']/div/div[2]"}'
driver.switch_to_alert();
driver.find_element_by_xpath("//div[@id='nameId']/div/div[2]").click()
selenium.common.exceptions.NoSuchElementException: Message: 'Unable to locate
element: {"method":"xpath","selector":"//div[@id=\'nameId\']/div/div[2]"}' ;
driver.switch_to_alert();
driver.find_elements_by_xpath("//div[@id='nameId']/div/div[2]").click()
time.sleep(10)
driver.find_element_by_xpath("//div[@class='nameId']/div[@sbisname='Ok']/div").click();
Answer the question
In order to leave comments, you need to log in
Hello. You need a switch_to_popup method, maybe switch_to_popup_window.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question