Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8371675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:13:15+00:00 2026-06-09T14:13:15+00:00

Presently, the application in which I am working has got many work flows that

  • 0

Presently, the application in which I am working has got many work flows that open new window one after another. I have used the following way to switch the focus to new window:

for (String popUpHandle : driver.getWindowHandles()) {
driver.switchTo().window(popUpHandle);
if(driver.getCurrentUrl().equalsIgnoreCase(URL of the new window)
...
}

Same way, I used it with page title. Used selenium.isElementPresent present to get inside the condition and do certain operation in the new window.

The above three solutions work fine, but takes too much time in IE when in one work flow, 2-3 windows remain hidden.

Any guidance to switch focus new window as soon as we open it after we click on some link or button, would be very much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:13:17+00:00Added an answer on June 9, 2026 at 2:13 pm

    One trick to speed it up a little bit is to always ignore the parent window. So do something like:

    //before any pop ups are open
    String parentHandle = driver.getWindowHandle();
    
    //after you have pop ups
    for (String popUpHandle : driver.getWindowHandles()) {
      if(!popUpHandle.equals(parentHandle)){
        driver.switchTo().window(popUpHandle);
        if(driver.getCurrentUrl().equalsIgnoreCase(URL of the new window)){
          //do something here
        }
      }
    }
    

    You can also switch to the most recent opened window this way since the collection should be ordered (* I think, don’t have access to a Selenium set up to test at the moment *):

    String newWindowHandle = driver.getWindowHandles()[driver.getWindowHandles().length - 1];
    driver.switchTo().window(newWindowHandle);
    

    Finally, not sure which version of Selenium you’re using but the latest IEDriver is significantly faster: http://code.google.com/p/selenium/wiki/InternetExplorerDriver

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a UIViewController that has a modal window which I'd like to present
Hello I am working with an application that already has a few validation criterion,
I am presently working on a application in which I have a display a
I am working on an application which needs scheduling (just like the one present
I have a working JNLP application which I need to distribute to various non-technical
I'm working on a questionnaire type application in which questions are stored in a
I have an MVC 2.0 application that I'm playing around with in VS2010 which
Working on a application which reads some values from an customers.xml file to UI.
I'm working on a web application which will be used for classifying photos of
I am working on a kiosk application which gives the user a selection of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.