bhargav julaganti
bhargav julaganti

Reputation: 73

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?

Upvotes: 1

Views: 1791

Answers (1)

alecxe
alecxe

Reputation: 473833

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.

Upvotes: 1

Related Questions