Comments (6)
I don't know. Maybe you can check with a debugger what is happening exactly (where this error is being raised in code).
Getting the alert text of course expects the alert to be present.
Maybe some generic handling (which is active before or after the actual alertText
method) throws this error? I've had similar issues in the past when I created subclasses where I forgot to take into account alert handling. It could be something from the subclasses of BrowserTest that are being used, or something in BrowserTest itself.
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
from hsac-fitnesse-fixtures.
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 alertText
method would be responsible for throwing such an alert; nor do see a reason for such generic handling code to intercept an UnhandledAlertException in case of an alertText
method.
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 ?
Webpage https://www.browserstack.com/guide/architecture-of-selenium-webdriver , section Architecture of Selenium 4 WebDriver , shows the W3C Protocol connecting "Selenium Client Libraries" and "Browser Drivers" .
Maybe I can set a breakpoint somewhere in the Selenium Client Library .
from hsac-fitnesse-fixtures.
Does executing this snippet:
|script|browser test |
|open |https://the-internet.herokuapp.com/javascript_alerts|
|click |Click for JS Alert |
|show |alert text |
|confirm alert |
|click |Click for JS Confirm |
|show |alert text |
|confirm alert |
|click |Click for JS Prompt |
|show |alert text |
|dismiss alert |
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
from hsac-fitnesse-fixtures.
I ran the snippet 20 times, and never got the "Unhandled alert" .
from hsac-fitnesse-fixtures.
Is it possible to set the log level of the webdriver ?
That might shed some light onto the problem.
https://www.selenium.dev/documentation/webdriver/browsers/edge/
shows java system properties
EdgeDriverService.EDGE_DRIVER_LOG_PROPERTY
and
EdgeDriverService.EDGE_DRIVER_LOG_LEVEL_PROPERTY
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 hsac-fitnesse-fixtures.
From looking at code from https://github.com/SeleniumHQ/seleniumhq.github.io/tree/trunk/examples/java
I found the correct command :
!define COMMAND_PATTERN {java -Dwebdriver.edge.logfile=C:\Users\PBEMMELE\paul\tmp\FixtureDebugTest\log.txt -Dwebdriver.edge.loglevel=all -cp %p %m}
The hope is, that the log file will provide some clue when the Unhandled alert
arises.
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 .
And use grep to look at specific lines .
For example, for the test snippet suggested by tnch 5 days ago, that opens https://the-internet.herokuapp.com/javascript_alerts
, I got the following lines when using some grep command:
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
from hsac-fitnesse-fixtures.
Related Issues (20)
- Webdriver issue CHROME 119 HOT 3
- 5.2.45 and up: org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools HOT 2
- Can this constant be defined in the SuiteSetup? HOT 1
- No interaction possible with "invisible" input fields HOT 2
- hsac fitnesse fixtures not working after angular upgrade to 14 in headless chrome HOT 1
- hsac/fitnesse-fixtures-test-jre11-chrome:5.3.6 is missing expected files HOT 4
- How to from $drmName get text uncle? HOT 2
- HIGH Vulnerabilities in transitive dependency HOT 7
- Why are the linux drivers explicitily excluded? HOT 1
- Images for version 5.3.8 are missing HOT 1
- Can we access shadow dom elements in our scripts ? HOT 3
- How to reset "pageLoadWait" value? HOT 2
- hsac.fixtures.version > 5.3.10 > This version of ChromeDriver only supports Chrome version 110 HOT 1
- How to use hsacfit to test the branch process? Are there any keywords that can be used? HOT 1
- The valueOf how get <div> text? HOT 2
- BrowserTest value of don't get the div text HOT 2
- How to config chrome extensions?
- how to set edge zoom to 100 percent ? HOT 2
- How can I increase javascript script timeout ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hsac-fitnesse-fixtures.