Handling browser pop-up windows with Selenium

0
0

We are running Selenium regression tests against our existing code base, and certain screens in our web app use pop-ups for intermediate steps.

Currently we use the commands in the test:

// force new window to open at this point - so we can select it later
selenium().getEval("this.browserbot.getCurrentWindow().open('', 'enquiryPopup')");
selenium().click("//input[@value='Submit']");
selenium().waitForPopUp("enquiryPopup", getWaitTime());
selenium().selectWindow("enquiryPopup");

…which works most of the time. Occasionally the test will fail on the waitForPopUp() line with

com.thoughtworks.selenium.SeleniumException: Permission denied

Can anyone suggest a better, more reliable method?

Also, we primarily run these tests on IE6 and 7.

  • You must to post comments
0
0

It works!! Just to make it easier for the folks who prefer selenese.

This worked for me using IE7(normal mode).

What a freaking hassle. Thank the spaghetti monster in the sky for SO or there is no way I would have got this working in IE.

<tr>
<td>getEval</td>
<td>selenium.browserbot.getCurrentWindow().open('', 'windowName');</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>buttonName</td>
<td></td>
</tr>
<tr>
<td>windowFocus</td>
<td>windowName</td>
<td></td>
</tr>
<tr>
<td>waitForPopUp</td>
<td>windowName</td>
<td>3000</td>
</tr>
<tr>
<td>selectWindow</td>
<td>windowName</td>
<td></td>
</tr>
  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website