Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

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.

1 Answer

0 votes
by (62.9k points)

I just trialed the below code by adding another selenium function, windowFocus():

// force new browser window to open at this point - so that later we can select it.

selenium().getEval("this.browserbot.getCurrentWindow().open('', 'enquiryPopup')");

selenium().click("//input[@value='Submit']");

selenium().windowFocus("enquiryPopup");

selenium().waitForPopUp("enquiryPopup", getWaitTime());

selenium().selectWindow("enquiryPopup");

The test succeeded when I ran it locally, but only along with all those methods calls - create/focus/wait/select.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...