Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

Getting below error

Window does not exist. If this looks like a Selenium bug, make sure to read http://seleniumhq.org/docs/02_selenium_ide.html#alerts-popups-and-multiple-windows for potential workarounds.

It's like when I click on the lookup icon a new window opens and when I select some value there and the page redirects of the active page. This scenario I'm not able to achieve through IDE automation.

share|improve this question

closed as unclear what you're asking by corsiKa Mar 14 at 17:49

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Is the situation the popup then updates the original active window, the popup goes away, and you need to go back to the main window? I have used WebDriver (Selenium) to go from popups, make a selection, and go back to an updated original window without errors –  MichaelF Dec 5 '13 at 14:06
    
Is your popup created with JavaScript? The link in the error says: "When running under Selenium, JavaScript pop-ups will not appear. This is because the function calls are actually being overridden at runtime by Selenium’s own JavaScript. However, just because you cannot see the pop-up doesn’t mean you don’t have to deal with it. To handle a pop-up, you must call its assertFoo(pattern) function. " –  dzieciou Jan 4 at 13:28

3 Answers 3

you can use Java AWT Robot class to handle the scenario. using this class you can perform mouse actions on basis of screen coordinates or you can use AutoIT to automate this process for handling windows popup which cannot be done by selenium itself because it works only on web elements.

share|improve this answer

There are limitations as to what can be replayed through Selenium IDE. It is not possible with IDE because the popup is not a html object and will not have any locator. It is an ActiveX object. I would suggest you try Selenium Webdriver.

Don't bother building tests using Selenium IDE, even though the Selenese script recorded by Selenium IDE can be converted to a webdriver script, you will loose chance of building modular tests if you do so. If application changes in future, you will have to modify all your tests independently.

Your best bet is to use Selenium Webdriver with C#(or Java) and also use some test framework like NUnit(or JUnit), so that non developers can run the tests using NUnit GUI using simple interface, that is the best approach I found so far. Following code is an example of how you can do it with selenium webdriver.

if(driver.switchTo().alert() != null) {
  Alert alert = driver.switchTo().alert();
  alert.accept(); // alternatively alert.dismiss();
} 
share|improve this answer

On clicking a link on the active page, a new tab gets opened.Is this the scenario you are looking for. Then, here is your answer. Firefox usually prevents opening new windows. So you should change Firefox settings to open popups. Refer the link http://support.mozilla.org/en-US/kb/pop-blocker-settings-exceptions-troubleshooting#w_pop-up-blocker-settings. Then use selectpopup and waitforpopup commands. Do the actions whatever you want on the newly opened tab. Once done, use close command-this will close the new tab. Use Selectwindow command to return back to the original window. Sample code.

<tr>
    <td>click</td>
    <td>css=a.edit-url-link</td>
    <td></td>
</tr>
<tr>
    <td>waitForPopUp</td>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>selectPopUp</td>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>waitForElementPresent</td>
    <td>css=b</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>css=b</td>
    <td></td>
</tr>
<tr>
    <td>verifyElementPresent</td>
    <td>//div[4]/ul/li/div/b</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>//div[4]/ul/li/div/b</td>
    <td></td>
</tr>
<tr>
    <td>waitForElementPresent</td>
    <td>css=td.datepickerSelected &gt; a</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>css=td.datepickerSelected &gt; a</td>
    <td></td>
</tr>
<tr>
    <td>waitForElementPresent</td>
    <td>//div[4]/ul/li[2]/a</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>//div[4]/ul/li[2]/a</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=first_name</td>
    <td>test</td>
</tr>
<tr>
    <td>type</td>
    <td>id=phone_num</td>
    <td>325235</td>
</tr>
<tr>
    <td>click</td>
    <td>id=customer_details</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>css=span.global_btn2_rt</td>
    <td></td>
</tr>
<tr>
    <td>close</td>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>selectWindow</td>
    <td>null</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>link=Sign Out See you soon!</td>
    <td></td>

Hope this helps.

share|improve this answer

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