Deepak Hiremath
Deepak Hiremath

Reputation: 1

How to close popup in Selenium using Java.?

I am unable to close popup (Find attached screenshot) in the website>> https://www.lambdatest.com/selenium-playground

enter image description here

I tried closing the element by using locators but I got element not interactable error and also I tried with getWindow Handle method but no use. Please help me on this.

Upvotes: -1

Views: 757

Answers (3)

Keerthana J
Keerthana J

Reputation: 1

You need to find the close button and click as follows.

WebElement alertBox = driver.findElement(By.xpath("//*@id='exit_popup_close']"));
alertBox.click();

Upvotes: 0

Razvan
Razvan

Reputation: 387

You need to click on X button. Here is the locator: css -> #exit_popup_close

Upvotes: 0

Narendra Kulkarni
Narendra Kulkarni

Reputation: 1

Below code used for alert/pop

Thread.sleep(3000); driver.switch().to.alert().dismiss()

Try to use above one.

Upvotes: -1

Related Questions