-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"alert text" gives "Unhandled alert: alert must be confirmed or dismissed before test can continue. Alert text: ..etc..." #634
Comments
I don't know. Maybe you can check with a debugger what is happening exactly (where this error is being raised in code). Maybe some generic handling (which is active before or after the actual Given that error only occurs sometimes makes it very hard to track down. Without some additional details I'm afraid I won't be able to help you |
I've searched the source code from hsac-fitnesse-fixtures , and found only lines that catch an UnhandledAlertException (in BrowserTest.java and AllFramesDecorator.java), but no lines that throw such an exception . I have the feeling that the webdriver throws an UnhandledAlertException when it shouldn't. I don't see how generic handling before or after the actual On page https://www.w3.org/TR/webdriver2/#user-prompts it says: When a user prompt appears, it is the task of the subsequent command to handle it. If the subsequent requested command is not one listed in this chapter, an unexpected alert open error will be returned. The command "Get Alert Text" is allowed when an alert is present. So no "unexpected alert open error" should be generated. What should I do to confirm that the webdriver is the root cause ? Maybe show in the W3C Protocol data that the browser driver generates an "unexpected alert open error" when it shouldn't ? |
Does executing this snippet:
Give you the same exception in some cases? In terms of setting breakpoints, I would start at get alert text and step into the selenium code from there |
I ran the snippet 20 times, and never got the "Unhandled alert" . |
Is it possible to set the log level of the webdriver ? https://www.selenium.dev/documentation/webdriver/browsers/edge/ I've tried these with command that starts FixtureDebugTest.main . That didn't work. The log file location doesn't get written to. And I've tried these as value for COMMAND_PATTERN at the top of the test script: !define COMMAND_PATTERN {java -DEdgeDriverService.EDGE_DRIVER_LOG_PROPERTY=C:\Users\PBEMMELE\paul\tmp\FixtureDebugTest\log.txt -DEdgeDriverService.EDGE_DRIVER_LOG_LEVEL_PROPERTY=ALL -cp %p %m} Doesn't work either: the log file doesn't get written to. |
From looking at code from https://github.com/SeleniumHQ/seleniumhq.github.io/tree/trunk/examples/java The hope is, that the log file will provide some clue when the I'm not sure how to make sense of the contents of the log file; it contains many lines, and I guess I'll have to look up the protocol for DevTools WebSocket .
pbemmele@V2W1-PBEMMELE /cygdrive/c/git/seleniumhq.github.io-trunk/examples/java/src/test/java
$ wc !$
wc "C:\Users\PBEMMELE\paul\tmp\FixtureDebugTest\log.txt"
4417 18069 351047 C:\Users\PBEMMELE\paul\tmp\FixtureDebugTest\log.txt
pbemmele@V2W1-PBEMMELE /cygdrive/c/git/seleniumhq.github.io-trunk/examples/java/src/test/java
$ grep -A1 -B1 "using" "C:\Users\PBEMMELE\paul\tmp\FixtureDebugTest\log.txt"
[1713717717.236][INFO]: [d9400923de8854e97989896069bb2098] COMMAND FindElements {
"using": "link text",
"value": "Click for JS Alert"
--
[1713717717.264][INFO]: [d9400923de8854e97989896069bb2098] COMMAND FindElements {
"using": "xpath",
"value": ".//a[descendant-or-self::text()[normalize-space(translate(., ' ', ' '))='Click for JS Alert']]"
--
[1713717717.287][INFO]: [d9400923de8854e97989896069bb2098] COMMAND FindElements {
"using": "xpath",
"value": ".//button[descendant-or-self::text()[normalize-space(translate(., ' ', ' '))='Click for JS Alert']]"
--
[1713717717.569][INFO]: [d9400923de8854e97989896069bb2098] COMMAND FindElements {
"using": "link text",
"value": "Click for JS Confirm"
--
[1713717717.594][INFO]: [d9400923de8854e97989896069bb2098] COMMAND FindElements {
"using": "xpath",
"value": ".//a[descendant-or-self::text()[normalize-space(translate(., ' ', ' '))='Click for JS Confirm']]"
--
[1713717717.612][INFO]: [d9400923de8854e97989896069bb2098] COMMAND FindElements {
"using": "xpath",
"value": ".//button[descendant-or-self::text()[normalize-space(translate(., ' ', ' '))='Click for JS Confirm']]"
--
[1713717717.766][INFO]: [d9400923de8854e97989896069bb2098] COMMAND FindElements {
"using": "link text",
"value": "Click for JS Prompt"
--
[1713717717.792][INFO]: [d9400923de8854e97989896069bb2098] COMMAND FindElements {
"using": "xpath",
"value": ".//a[descendant-or-self::text()[normalize-space(translate(., ' ', ' '))='Click for JS Prompt']]"
--
[1713717717.817][INFO]: [d9400923de8854e97989896069bb2098] COMMAND FindElements {
"using": "xpath",
"value": ".//button[descendant-or-self::text()[normalize-space(translate(., ' ', ' '))='Click for JS Prompt']]"
pbemmele@V2W1-PBEMMELE /cygdrive/c/git/seleniumhq.github.io-trunk/examples/java/src/test/java
|
I have a script that tests a webapplication.
It tests that the webapplication generates the correct alerts when input doesn't meet the requirements of the webapplication.
Sometimes the command "alert text" , that gets the expected alert message , generates an "Unhandled alert" error; see screenshot.
Why does Fitnesse generate that error ? Surely the "alert text" command expects an alert to be present .
The script uses IndWebBrowser that it is a subclass of WebBrowser, that is a subclass of BrowserTest . The subclasses of BrowserTest do not override alertText() .
The text was updated successfully, but these errors were encountered: