In HTML there is the code(its not my page)
<script>
alert('1');
</script>
How can I test it with Selenium IDE (click the alert) 开发者_运维技巧???
I tried answers from this question Click in OK button inside an Alert (Selenium IDE) but it does not work.
Selenium IDE does not currently handle alerts. There is an open issue concerning the ability to handle alerts and prompts; unfortunately it's been open for quite some time (since Halloween 2007), so your best bet is to split your test into two parts, one before the alert and one after it, and dismiss the alert manually.
You cannot, sorry. alert
is a modal box that cannot be programmability dismissed, it requires user interaction (which is by design)
There are a number of functions that help you deal with alerts/prompts/confirmations. Here are a few that I found:
defaultSelenium.chooseCancelOnNextConfirmation();
defaultSelenium.chooseOkOnNextConfirmation();
defaultSelenium.getAlert();
defaultSelenium.getPrompt();
defaultSelenium.isAlertPresent();
defaultSelenium.isConfirmationPresent();
defaultSelenium.isPromptPresent();
精彩评论