Alert Handling - Selenium WebDriver/ Selenium RC 2.18.0 - Exception
Asked Answered
H

1

6

My automation test software for a web application runs on IE, Firefox, Chrome and Safari, and is written using C# and Selenium WebDriver (IE, Firefox, Chrome), Selenium RC (Safari).

A new error occurred when I upgraded to version 2.18.0 today. I am seeing the following exception:

System.InvalidOperationException: Modal dialog present (UnexpectedAlertOpen)

I saw this exception beingn thrown for IE, Firefox and Safari so far.

I looked up the release documentation and did not find anything that suggests that I should do differently to accept or cancel on alerts.

Is this a bug, or is there a new procedure to follow pertaining to alerts?

Hebetic answered 31/1, 2012 at 18:29 Comment(2)
OK, I found the problem. I am reading the current window handle "String currentWindowHandle = m_WebDriver.CurrentWindowHandle;" first, before the line "IAlert alert = m_WebDriver.SwitchTo().Alert();" I deleted the first line (as it was quite unnecessary) and the problem disappeared. As the exception message implies, another operation was being done while an alert was open (which in this case, was the operation to read the window handle). This was probably a Selenium WebDriver/RC cleanup done in 2.18.0.Hebetic
@UshaPugalia make an answer from your comment.Gilliangilliard
C
1

I had the same problem on my ccnet build server with Firefox since last update and I found that I need a update of my java version because of a security issue.

After the update all my test succeed and I had no more this error "System.InvalidOperationException: Modal dialog present (UnexpectedAlertOpen)".

Casady answered 24/5, 2012 at 14:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.