问题
I am using selenium IDE to record the commands. I need to test the red rout for login screen. But Selenium is not recognizing the alert coming from the application. Highlighted in bold alert message is not captured by the selenium IDE.
selenium.open("http://192.168.132.244:8080/SampleApp/");
assertEquals("SampleApp", selenium.getTitle());
selenium.type("name=userame", "NoUser"); --USER NAME
selenium.type("name=password", "Password1"); --Password
selenium.click("css=input[type=\"image\"]"); --Login button
selenium.waitForPageToLoad("30000");
Please enter correct Username and Password. -- Alert message
assertEquals("SampleApp", selenium.getTitle());
Please help me out completing this selenium...
回答1:
Try out this 1
assertEquals("Please enter correct Username and Password.", selenium.getAlert());
Let me know whether working or not.
回答2:
I've also had success with waitForAlert versus an assert or verify, but as with all your mileage may vary.
回答3:
USe this command hope this will help you
<tr>
<td>storeAlert</td>
<td>a</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>${a}</td>
<td></td>
</tr>
来源:https://stackoverflow.com/questions/9494926/selenium-ide-not-capturing-the-popup-alerts