Selenium IDE not capturing the popup/ Alerts

这一生的挚爱 提交于 2021-01-28 19:46:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!