简体   繁体   中英

how to handle popup in selenium webdriver (which is not alert)?

2) A pop will display showing to enter email address to register.

3) Since it is not a pop up I am not able to navigate to the window

I tried using alerts, javascriptexecutor and windowhandles but does not work. Could any suggest how to handle it?

This is not a popup window . Locate it as you would locate any other element on a page.

For instance, here is how you can locate the "close" button and click it:

WebDriverWait wait = WebDriverWait(driver, 10);
WebElement closeButton = wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div.modal button.close")));
closeButton.click();

Note that we are using a WebDriverWait explicit wait mechanism to wait for the close button to become visible.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM