How to handle Pop-up in Selenium WebDriver using Java

To switch to a popup window, you need to use getWindowHandles() and iterate through them. In your code you are using getWindowHandle() which will give you the parent window itself. String parentWindowHandler = driver.getWindowHandle(); // Store your parent window String subWindowHandler = null; Set<String> handles = driver.getWindowHandles(); // get all window handles Iterator<String> iterator = … Read more

Detecting the onload event of a window opened with window.open

var myPopup = window.open(…); myPopup.addEventListener(‘load’, myFunction, false); If you care about IE, use the following as the second line instead: myPopup[myPopup.addEventListener ? ‘addEventListener’ : ‘attachEvent’]( (myPopup.attachEvent ? ‘on’ : ”) + ‘load’, myFunction, false ); As you can see, supporting IE is quite cumbersome and should be avoided if possible. I mean, if you need … Read more

How to handle authentication popup with Selenium WebDriver using Java

The Alert Method, authenticateUsing() lets you skip the Http Basic Authentication box. WebDriverWait wait = new WebDriverWait(driver, 10); Alert alert = wait.until(ExpectedConditions.alertIsPresent()); alert.authenticateUsing(new UserAndPassword(username, password)); As of Selenium 3.4 it is still in beta Right now implementation is only done for InternetExplorerDriver

How to generate a simple popup using jQuery

First the CSS – tweak this however you like: a.selected { background-color:#1F75CC; color:white; z-index:100; } .messagepop { background-color:#FFFFFF; border:1px solid #999999; cursor:default; display:none; margin-top: 15px; position:absolute; text-align:left; width:394px; z-index:50; padding: 25px 25px 20px; } label { display: block; margin-bottom: 3px; padding-left: 15px; text-indent: -15px; } .messagepop p, .messagepop.div { border-bottom: 1px solid #EFEFEF; margin: 8px … Read more