Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Thread.sleep(2000);
- // Store the current window handle
- String winHandleBefore = driver.getWindowHandle();
- // Perform the click operation that opens new window
- // Switch to new window opened
- for(String winHandle : driver.getWindowHandles()){
- driver.switchTo().window(winHandle);
- }
- // Perform the actions on new window
- driver.findElement(By.xpath("ur xpath of that search box")).click();
- driver.findElement(By.xpath("ur xpath of that search box")).clear();
- driver.findElement(By.xpath("ur xpath of that search box")).sendKeys("ur text");
- // Close the new window, if that window no more required
- driver.close();
- // Switch back to original browser (first window)
- driver.switchTo().window(winHandleBefore);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement