I want to provide focus to another window in firefox while switching between two windows

0 votes
if(BrowserLaunch.browser.equalsIgnoreCase("Firefox"))

{

WebDriverWait wait = new WebDriverWait(Driver.driver, 120);

String parentWin = Driver.driver.getWindowHandle();

Thread.sleep(1000);

BookPlayer.btn_Vocabulary().click();

Thread.sleep(1000);

Driver.driver.switchTo().window(Login_Action.parentWin);

System.out.println(Driver.driver.getTitle());

for (String childWin : Driver.driver.getWindowHandles())

{

if(!Login_Action.parentWin.equals(childWin)){

Driver.driver.switchTo().window(childWin);

Driver.driver.close();

break;

}

}

Thread.sleep(5000);

Driver.driver.switchTo().window(parentWin);
Mar 27, 2019 in Selenium by anonymous
221 views
please format your code properly.
So can you tell more about what problem you are facing?

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Selenium

0 votes
1 answer

How to switch between two windows in browser using Selenium java

Yes, this is possible. First, you need ...READ MORE

answered Sep 25, 2018 in Selenium by Meci Matt
• 9,460 points
5,853 views
0 votes
1 answer

How to open Firefox window in Incognito mode using Selenium Webdriver?

Hi Pritha, you can use this code ...READ MORE

answered May 14, 2019 in Selenium by Anvi
• 14,010 points
1,269 views
0 votes
1 answer
0 votes
1 answer

Selenium ChromeDriver issue - Want to run it in background, but not as headless browser

This is a flaw with ChromeDriver. Tried ...READ MORE

answered Mar 26, 2018 in Selenium by nsv999
• 5,510 points
2,119 views
0 votes
1 answer

Need to switch between frames in Selenium

For switching between frames, use driver.switchTo().frame(). First ...READ MORE

answered Apr 6, 2018 in Selenium by nsv999
• 5,510 points
1,380 views
0 votes
1 answer

How do i change the location where my file gets downloaded in Selenium Webdriver and firefox driver?

There are a couple of errors there. ...READ MORE

answered Apr 12, 2018 in Selenium by nsv999
• 5,510 points
2,350 views
0 votes
1 answer

How can I Install Selenium IDE in Firefox

Selenium IDE works with all Firefox versions, ...READ MORE

answered Apr 13, 2018 in Selenium by Meci Matt
• 9,460 points
276 views