1

I am beginner automation tester. Currently using Selenium IDE and I am trying to open a page in a new browser tab. Used the following commands:

(1) Click (2) WaitForPopUp (3) Select Popup (4) VerifyText (5) Close (6) SelectWindow

The object that is being clicked is an image with a link and when clicked, it is supposed to open a new page in a separate tab. Browser being used is FireFox. Any help would be most appreciated.

3
  • 1
    What is your problem? When clicked, new tabs does open and you cannot switch to it? Or tab does not open? Also, new test will get new FF profile, which might have popups disabled by default. Commented Nov 3, 2016 at 22:29
  • New Tab opens, but, I can not get to it. I've used the above commands before, but, for some reason on this particular image link the commands are not working.
    – A Wilson
    Commented Nov 4, 2016 at 13:30
  • treat as a new window and use switchTo stackoverflow.com/a/9597714/631619 Commented Nov 7, 2016 at 0:48

2 Answers 2

2

Example URL: http://www.htmlcodetutorial.com/linking/_A_TARGET_95y98y108y97y110y107y.html

Example Element: <a href="newwindow.html" target="_blank">a new window</a>

Solution in IDE

  1. Enter http://www.htmlcodetutorial.com/ as your Base URL
  2. Click the record button
    • Navigate to http://www.htmlcodetutorial.com/linking/_A_TARGET_95y98y108y97y110y107y.html
    • Left-click the a new window link
    • Right-click on the page and select verifyTitle A Whole New Window – HTML Code Tutorial
    • Close the new window/tab
    • Right-click on the original window/tab page and select verifyTitle HTML _blank – HTML Code Tutorial
  3. In Selenium IDE, click the record button to stop recording
  4. Add a pause 1000 step after the click step to give the window/tab time to load
  5. Add a selectWindow A Whole New Window – HTML Code Tutorial step after the pause to connect to the new window/tab
  6. Add a close step after the verifyTitle A Whole New Window – HTML Code Tutorial step
  7. Add a selectWindow HTML _blank – HTML Code Tutorial step after the close step
  8. Select Play Current Test Case to verify the test
1

I'm using IDE commands to open a new window (not a panel), to do something in a different application.

Essential is to select window according to the window label (title) and closing the window and selecting null after it is finished.

Hope this will help. Example of opening a page, which I'm using to get swift data of random bank:

<tr>
    <td>openWindow</td>
    <td>https://transferwise.com/swift-codes/countries</td>
    <td></td>
</tr>
<tr>
    <td>pause</td>
    <td>5000</td>
    <td></td>
</tr>
<tr>
    <td>selectWindow</td>
    <td>title=Search Swift / BIC codes by country - TransferWise</td>
    <td></td>
</tr>
<tr>
    <td>waitForElementPresent</td>
    <td>//div[@id=&quot;country-Z&quot;]</td>
    <td></td>
</tr>

...

<tr>
    <td>close</td>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>selectWindow</td>
    <td>null</td>
    <td></td>
</tr>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.