3409/how-to-close-browser-popup-in-selenium-webdriver
You can do this using the below code:
( ( JavascriptExecutor ) _driver).executeScript( "window.onbeforeunload = function(e){};" );
Hey Vasuki, you can simply handle the pop-up by using following code snippet:
// Accepts (Click on OK) on Alert Pop-up window Alert alertOK = driver.switchTo().alert(); alertOK.accept(); //Rejects (Click on Cancel) on Alert pop-up window. Alert alertCancel = driver.switchTo().alert(); alertCancel.dismiss();
Tried with below snippet of code, it is failing. Can you please help me ?
@Test(priority=3)
public void display() throws InterruptedException, AWTException {
( ( JavascriptExecutor )driver )
.executeScript( "window.onbeforeunload = function(e){};" );
driver.close();
Alert alertCancel = driver.switchTo().alert();
alertCancel.dismiss();
Thread.sleep(14000);
System.out.println("==Executted==");
}
Hi , we have inbuilt method Maximize(). driver.Manage().Wind ...READ MORE
Hey Uday, you can write following lines ...READ MORE
Hi Lerry, you can disable Infobars displayed ...READ MORE
Generally, we scrap the data from websites ...READ MORE
The better way to handle this element ...READ MORE
enable trusted connection in internet explorer by ...READ MORE
To Allow or Block the notification, access using Selenium and you have to ...READ MORE
xpath are two types. 1) Absolute XPath: /html/b ...READ MORE
This below code works for me in ...READ MORE
Check the below code: Here is the working ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.