question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[šŸ› Bug]: Randomly get org.openqa.selenium.WebDriverException: Unable to parse:

See original GitHub issue

What happened?

I was trying to find a way to reproduce the org.openqa.selenium.TimeoutException: java.net.http.HttpTimeoutException from https://github.com/SeleniumHQ/selenium/issues/9528#issuecomment-1282632363 but I face randomly another exception : org.openqa.selenium.WebDriverException: Unable to parse:

I don’t know why I have this exception because the test can run with success more than 500 times.

How can we reproduce the issue?

https://github.com/JulienBreton/selenium_4_5_0_unable_to_parse

Relevant log output

firefox_1       | 14:41:23.704 DEBUG [HttpClientImpl$SelectorAttachment.register] - [HttpClient-1-SelectorManager] [360s 247ms] SelectorAttachment Registering jdk.internal.net.http.SocketTube$InternalReadPublisher$ReadEvent@f47a8ca for 0 (false)
firefox_1       | 14:41:23.704 DEBUG [SocketTube$InternalReadPublisher$ReadSubscription.signalCompletion] - [HttpClient-1-SelectorManager] [360s 247ms] SocketTube(1) completing subscriber
firefox_1       | 14:41:23.705 DEBUG [ConnectionPool.cleanup] - [HttpClient-1-SelectorManager] [360s 247ms] ConnectionPool(1) SocketTube(1) : ConnectionPool.cleanup(null)
firefox_1       | 14:41:23.705 DEBUG [PlainHttpConnection.close] - [HttpClient-1-SelectorManager] [360s 248ms] PlainHttpConnection(SocketTube(1)) Closing channel: channel registered with selector, key.interestOps=1, sa.interestOps=1
firefox_1       | 14:41:23.706 DEBUG [SocketTube$InternalReadPublisher$InternalReadSubscription.signalError] - [HttpClient-1-SelectorManager] [360s 248ms] SocketTube(1) got read error: java.io.IOException: connection closed locally
firefox_1       | 14:41:23.706 DEBUG [SocketTube.debugState] - [HttpClient-1-SelectorManager] [360s 248ms] SocketTube(1) leaving read() loop after EOF:  Reading: [ops=0, demand=0, stopped=true], Writing: [ops=0, demand=1]
firefox_1       | 14:41:23.706 DEBUG [SocketTube$InternalReadPublisher$InternalReadSubscription.read] - [HttpClient-1-SelectorManager] [360s 248ms] SocketTube(1) Read scheduler stopped
firefox_1       | 14:41:23.707 DEBUG [HttpClientImpl$SelectorAttachment.resetInterestOps] - [HttpClient-1-SelectorManager] [360s 249ms] SelectorAttachment key cancelled for java.nio.channels.SocketChannel[closed]
firefox_1       | 14:41:23.708 DEBUG [SocketTube$SocketFlowEvent.abort] - [HttpClient-1-SelectorManager] [360s 250ms] SocketTube(1) abort: java.io.IOException: java.nio.channels.CancelledKeyException
firefox_1       | 14:41:23.708 DEBUG [HttpClientImpl$SelectorManager.run] - [HttpClient-1-SelectorManager] [360s 250ms] HttpClientImpl(1) next timeout: 0
firefox_1       | 14:41:23.708 DEBUG [HttpClientImpl$SelectorManager.run] - [HttpClient-1-SelectorManager] [360s 250ms] HttpClientImpl(1) next expired: 0
firefox_1       | 14:41:23.708 DEBUG [HttpClientImpl$SelectorManager.run] - [HttpClient-1-SelectorManager] [360s 250ms] HttpClientImpl(1) Next deadline is 3000
firefox_1       | 14:41:23.758 INFO [SessionSlot.stop] - Stopping session d739c9fa-894a-47a2-8902-35ed5122dbaa
firefox_1       | 14:41:23.759 DEBUG [SeleniumSpanExporter$1.lambda$export$4] - SpanData{spanContext=ImmutableSpanContext{traceId=fec1784a18e1444a4a12474904f72a61, spanId=3ee8b4c565d4b332, traceFlags=01, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=true}, parentSpanContext=ImmutableSpanContext{traceId=fec1784a18e1444a4a12474904f72a61, spanId=cf0dc2dcd0a6fc6b, traceFlags=01, traceState=ArrayBasedTraceState{entries=[]}, remote=true, valid=true}, resource=Resource{schemaUrl=https://opentelemetry.io/schemas/1.13.0, attributes={service.name="unknown_service:java", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.19.0"}}, instrumentationScopeInfo=InstrumentationScopeInfo{name=default, version=null, schemaUrl=null, attributes={}}, name=node.forward_command, kind=INTERNAL, startEpochNanos=1666363283331000000, endEpochNanos=1666363283758849951, attributes=AttributesMap{data={span.kind=server, http.target=/session/d739c9fa-894a-47a2-8902-35ed5122dbaa, random.key=fd3d0bf9-15eb-499d-8a68-fb3269804880, http.status_code=200, http.method=DELETE}, capacity=128, totalAddedValues=5}, totalAttributeCount=5, events=[ImmutableEventData{name=HTTP request execution complete, attributes={http.flavor=1, http.handler_class="org.openqa.selenium.remote.http.Route$PredicatedRoute", http.host="172.18.0.4:5555", http.method="DELETE", http.request_content_length="0", http.scheme="HTTP", http.status_code=200, http.target="/session/d739c9fa-894a-47a2-8902-35ed5122dbaa", http.user_agent="selenium/4.5.2 (java unix)"}, epochNanos=1666363283758847553, totalAttributeCount=9}], totalRecordedEvents=1, links=[], totalRecordedLinks=0, status=ImmutableStatusData{statusCode=OK, description=Kind: OK Description:}, hasEnded=true}
firefox_1       | 14:41:23.760 DEBUG [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "fec1784a18e1444a4a12474904f72a61","eventTime": 1666363283758847553,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "172.18.0.4:5555","http.method": "DELETE","http.request_content_length": "0","http.scheme": "HTTP","http.status_code": 200,"http.target": "\u002fsession\u002fd739c9fa-894a-47a2-8902-35ed5122dbaa","http.user_agent": "selenium\u002f4.5.2 (java unix)"}}
firefox_1       | 
selenium-hub_1  | 14:41:23.761 INFO [GridModel.release] - Releasing slot for session id d739c9fa-894a-47a2-8902-35ed5122dbaa
selenium-hub_1  | 14:41:23.761 INFO [LocalSessionMap.lambda$new$0] - Deleted session from local Session Map, Id: d739c9fa-894a-47a2-8902-35ed5122dbaa
firefox_1       | 14:41:26.711 DEBUG [HttpClientImpl$SelectorManager.run] - [HttpClient-1-SelectorManager] [363s 254ms] HttpClientImpl(1) next timeout: 0
firefox_1       | 14:41:26.712 DEBUG [HttpClientImpl$SelectorManager.run] - [HttpClient-1-SelectorManager] [363s 254ms] HttpClientImpl(1) next expired: 0
firefox_1       | 14:41:26.712 DEBUG [HttpClientImpl$SelectorManager.run] - [HttpClient-1-SelectorManager] [363s 254ms] HttpClientImpl(1) Next deadline is 300

### Log from the test.
...
1000
1001
1002
1003
1004
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 361.259 s <<< FAILURE! - in TestSuite
[ERROR] waitTest(demoWait.TestWait)  Time elapsed: 355.858 s  <<< FAILURE!
org.openqa.selenium.WebDriverException: 
Unable to parse: 
Build info: version: '4.5.2', revision: '702c64f787c'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-131-generic', java.version: '11.0.16'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [d739c9fa-894a-47a2-8902-35ed5122dbaa, findElement {using=id, value=secondes}]
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 106.0.1, moz:accessibilityChecks: false, moz:buildID: 20221019185550, moz:debuggerAddress: 127.0.0.1:29248, moz:firefoxOptions: {}, moz:geckodriverVersion: 0.32.0, moz:headless: false, moz:platformVersion: 5.4.0-131-generic, moz:processID: 172, moz:profile: /tmp/rust_mozprofilek6OWCr, moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, moz:windowless: false, pageLoadStrategy: normal, platformName: LINUX, proxy: Proxy(), se:bidi: ws://172.18.0.4:4444/sessio..., se:cdp: ws://172.18.0.4:4444/sessio..., se:cdpVersion: 85.0, se:noVncPort: 7900, se:vnc: ws://172.18.0.4:4444/sessio..., se:vncEnabled: true, se:vncLocalAddress: ws://172.18.0.4:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: d739c9fa-894a-47a2-8902-35ed5122dbaa
	at demoWait.TestWait.waitTest(TestWait.java:58)

Operating System

Ubuntu 18.04.6 / java.version: ā€˜11.0.16’

Selenium version

selenium-java & selenium-http-jdk-client : 4.5.2 / Selenium Docker 4.5.2-20221021

What are the browser(s) and version(s) where you see this issue?

Firefox v.106.0 / Chome v.106.0

What are the browser driver(s) and version(s) where you see this issue?

Selenium Docker 4.5.2-20221021

Are you using Selenium Grid?

Selenium Grid 4.5.2 (revision 702c64f787c)

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
JulienBretoncommented, Nov 7, 2022

I didn’t have much hope when I opened this issue but now Selenium 4 is stable. No ā€œUnable to parseā€ or ā€œFailed to decode request as JSONā€. Thanks a lot @joerg1985 !

1reaction
joerg1985commented, Oct 24, 2022

@JulienBreton Could you set <trimStackTrace>false</trimStackTrace> in the <configuration> of the maven-surefire-plugin. This should lead to a longer stack trace after the test failed, see: https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#trimStackTrace

Read more comments on GitHub >

github_iconTop Results From Across the Web

org.openqa.selenium.WebDriverException: Unable to parse ...
I'm trying to write test cases using selenium. I wrote this code. And i got this error. org.openqa.selenium.WebDriverException: Unable to ...
Read more >
Org.openqa.selenium.WebDriverException: Unable to parse ...
I am getting below error while running a test on grid: [code:16kw7eb1]org.openqa.selenium.WebDriverException: Unable to parse remoteĀ ...
Read more >
Unable to get the CPU usage data from appium performance ...
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Unable to parseĀ ...
Read more >
Common Error Messages - Sauce Labs Documentation
The most common causes for this error are either unresponsive JavaScript in your app, or a bug in Selenium/Appium. A less common, but...
Read more >
"Can not attach to current VM" error message on trying to ...
I now get below error message: org.openqa.selenium.WebDriverException: Unable to parse remote response: at org.openqa.selenium.remote.ProtocolHandshake.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found