How to handle multiple windows in Selenium Webdriver?

0 votes
How to handle multiple windows in Selenium Webdriver?
May 24 in Selenium by Ritika
46 views

1 answer to this question.

0 votes

Hey Ritika, you can handle multiple windows in Selenium Webdriver by using driver.getWindowHandles() method. Check this code snippet for understanding better:

    String currentWindow = driver.getWindowHandle(); //get parent(current) window name
    for(String popup :driver.getWindowHandles()) //iterating on child windows
    {
    	driver.switchTo().window(popup);
    	System.out.println("Popup values: "+popup);
    	// Perform any operations on child window
    }
    driver.switchTo().window(currentWindow); //switch back to main window & continue further execution
answered May 24 by Anvi
• 11,690 points

Related Questions In Selenium

0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,050 points
1,790 views
0 votes
1 answer

How to handle Pop-up in Selenium WebDriver using Java

Actually, its pretty simple. Use this code ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,050 points
3,812 views
0 votes
1 answer

How to handle the popup of file upload in Windows OS with WebDriver?

The value of name locator has probably ...READ MORE

answered Apr 25, 2018 in Selenium by king_kenny
• 3,610 points
2,579 views
0 votes
1 answer

How to handle notifications in Python with Selenium (Chrome WebDriver)

Below will help you: You can disable the ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
2,038 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
403 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
760 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
400 views
0 votes
1 answer

How to handle Bootstrap dropdown in Selenium Webdriver?

Hi Neeru, Bootstrap dropdown isn't like traditional ...READ MORE

answered Jul 18 in Selenium by Anvi
• 11,690 points
42 views
0 votes
1 answer

How to click on Image in Selenium Webdriver?

Hello Lalit, I guess you mean to ...READ MORE

answered May 9 in Selenium by Anvi
• 11,690 points
177 views