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 3931922
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:24:00+00:00 2026-05-19T23:24:00+00:00

So, using Selenium, I want to test links on a page and see if

  • 0

So, using Selenium, I want to test links on a page and see if they open a new window. They are NOT javascript links, just a basic href “target=_blank”.
I want to make sure the newly opened window actually loaded a page.
I can do all the scripting to get the link clicked, but when i test for page Title, I get the page I’m testing on, not the new window that is on top.
How do I target that new window and check to see if THAT page loaded?

thanks

  • 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-05-19T23:24:01+00:00Added an answer on May 19, 2026 at 11:24 pm

    The following worked for me with a form with attribute target=”_blank” that sends a POST request on a new window:

    // Open the action in a new empty window
    selenium.getEval("this.page().findElement(\"//form[@id='myForm']\").target='my_window'");
    selenium.getEval("selenium.browserbot.getCurrentWindow().open('', 'my_window')");
    
    //The contents load in the previously opened window
    selenium.click("//form[@id='myForm']//input[@value='Submit']");
    Thread.sleep(2000);
    
    //Focus in the new window
    selenium.selectWindow("my_window");
    selenium.windowFocus();
    /* .. Do something - i.e.: assertTrue(.........); */
    
    //Close the window and back to the main one
    selenium.close();
    selenium.selectWindow(null);
    selenium.windowFocus();
    

    The html code would be similar to:

    <form id="myForm" action="/myAction.do" target="_blank">
        <input type="text" name="myText" value="some text"/>
        <input type="submit" value="Save"/>
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am testing a calendar component using Selenium. In my test I want to
I am using selenium IDE (1.5.0) to make test cases, and I want to
I want a unit-test framework for JavaScript which runs in the browser . Not
I've just started using Selenium-IDE (not looked at selenium-RC yet: if somebody tells me
I'm using selenium-client to test a site. I want to get all a tags
I'm using selenium-rc with php. I want to show in my test the value
I have created a Selenium test using the Firefox Addon. Now, I want to
I'm using Selenium WebDriver with Java. I want to use Safari browser. Does Selenium
I am using Selenium IDE Firefox plugin to create some test cases. I click
I'm using Selenium IDE 1.7.2 and Firefox 10.0.2 In the page which I'm writing

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.