Can't capture alert ,which is tiggered by the key word "Execute Javascript"
You can captrue alert which is triggered by some event,bu you can't get it when triggered by "Execute Javascript"
the RF scripts is as follow:
*** Settings *** Library Selenium2Library
*** Test Cases *** alerttest open browser http://localhost:7272 ie click button button Alert Should Be Present Hello!
AlertTriggeredbyJavascript sleep 1s execute javascript window.f() Alert Should Be Present Hello!
and the second test case failed!
+KEYWORD: BuiltIn.Sleep 1s
Documentation: Pauses the test executed for the given time.
Start / End / Elapsed: 20120222 10:21:50.109 / 20120222 10:21:51.109 / 00:00:01.000
+KEYWORD: Selenium2Library.Execute Javascript window.f()
Documentation: Executes the given JavaScript code.
Start / End / Elapsed: 20120222 10:21:51.109 / 20120222 10:21:53.375 / 00:00:02.266
-+
KEYWORD: Selenium2Library.Alert Should Be Present Hello!
Documentation: Verifies an alert is present and dismisses it.
Start / End / Elapsed: 20120222 10:21:53.375 / 20120222 10:21:55.046 / 00:00:01.671
+KEYWORD: Selenium2Library.Capture Page Screenshot
Documentation: Takes a screenshot of the current page and embeds it into the log.
Start / End / Elapsed: 20120222 10:21:53.390 / 20120222 10:21:54.281 / 00:00:00.891
+KEYWORD: Selenium2Library.Capture Page Screenshot
Documentation: Takes a screenshot of the current page and embeds it into the log.
Start / End / Elapsed: 20120222 10:21:54.281 / 20120222 10:21:55.046 / 00:00:00.765
10:21:55.046 INFO
10:21:55.046 FAIL There were no alerts
IS there any difference between the tow way?
Here is the HTML under testing : [input type="submit" name="button" id="button" value="提交" onclick="f()" /] [script type="text/javascript"] function f() { alert("Hello!") } [/html]
this issue is continuing bugging me ,plz help to solve it.
The problem of dismissing an alert box in Selenium2 appears to be a problem across the board. See:
http://stackoverflow.com/questions/9195753/how-to-quit-modal-dialog-window-in-selenium-headless-browser
I test with chromedriver on Win7 and I'm getting the error below because an alert box pops up and is not being dismissed:
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: WebDriverException: Message: u'An open modal dialog blocked the operation' | FAIL |
There were no alerts
This issue is old and has had no action on it for several years. If an issue still exists please open a new issue.