rtomac/robotframework-selenium2library — Issue #35: Can't capture  alert ,which is tiggered by the key word "Execute Javascript"
Author: lucasliu
Created: 2012-02-22 02:36:58+00:00
State: open

You can captrue alert which is triggered by some event,bu you can't get it when triggered by "Execute Javascript"

Here is the HTML under testing :

无标题文档

-------------------------------------------------------------------------------------
and the RF scripts:

*** 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?