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.

SeleniumIDE Issue - js alert() is not detected by IDE

These steps will reproduce the problem:

  1. Open http://www.w3schools.com/js/tryit.asp?filename=tryjs_alert2
  2. Click on the "try it" button
  3. The clicking of OK on alert is not captured by IDE
share|improve this question
    
Hi user1579906. A comment was left in the other question where you asked this explaining that this would happen with Selenium IDE and Javascript Alerts. Is this different? –  Lyndon Vrooman Aug 13 '13 at 14:24
    
Wanted a workaround or solution to this issue –  user1579906 Aug 13 '13 at 15:35
add comment

1 Answer

The problem is that this button and alert is generate in an iFrame. Selenium handles iFrame as a sort of window, you first need to select it to interact with it.

Try these steps to verify it does indeed work:

<tr>
    <td>open</td>
    <td>http://www.w3schools.com/js/tryit.asp?filename=tryjs_alert2</td>
    <td></td>
</tr>
<tr>
    <td>selectFrame</td>
    <td>id=iframeResult</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>xpath=//button</td>
    <td></td>
</tr>

Result is an message in the IDE console: [error] Error: There was an unexpected Alert! [Hello How are you?]

Also read this about handling javascript alerts with the Selenium IDE: http://stackoverflow.com/questions/14788118/selenium-ide-how-to-handle-java-script-alerts-and-confirmations

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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