selenium: [🐛 Bug]: TimeoutException when trying to intercept traffic with selenium grid
What happened?
I’m trying to capture and modify a network call.
I’ve prepared a sample project to reproduce the issue.
https://github.com/baflQA/selenium-debug
First, I start the selenium grid using docker-selenium images (https://github.com/baflQA/selenium-debug/blob/main/runGridStandalone.sh)
Then, I start a new browser.
The driver is augmented, the devTool connection is initiated.
I navigate to a webpage, and capture some response.
I get this response data, and store it in a variable.
Then, I modify captured response.
Finally, I create a new NetworkInterceptor instance, in order to capture and replace the original response for a given request with the modified one.
I try to refresh the page, but once the network interceptor is registered, all the network traffic will be blocked.
As a result, there will be an error thrown:
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.5.1', java.version: '11.0.20' Driver info: driver.version: unknown at org.openqa.selenium.devtools.Connection$Listener.lambda$onText$0(Connection.java:227) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: org.openqa.selenium.TimeoutException: java.util.concurrent.TimeoutException Build info: version: '4.12.1', revision: '8e34639b11' System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.5.1', java.version: '11.0.20' Driver info: driver.version: unknown at org.openqa.selenium.devtools.Connection.sendAndWait(Connection.java:183) at org.openqa.selenium.devtools.DevTools.send(DevTools.java:89) at org.openqa.selenium.devtools.idealized.Network.lambda$prepareToInterceptTraffic$5(Network.java:258) at org.openqa.selenium.devtools.Connection.lambda$handle$4(Connection.java:330) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) at java.base/java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:442)
The issue is not reproducible when a non-remote driver is used.
How can we reproduce the issue?
Check this repository https://github.com/baflQA/selenium-debug/blob/main/src/test/java/seleniumdebug/NetworkCaptureTest.java
Relevant log output
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.5.1', java.version: '11.0.20'
Driver info: driver.version: unknown
at org.openqa.selenium.devtools.Connection$Listener.lambda$onText$0(Connection.java:227)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.openqa.selenium.TimeoutException: java.util.concurrent.TimeoutException
Build info: version: '4.12.1', revision: '8e34639b11'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.5.1', java.version: '11.0.20'
Driver info: driver.version: unknown
at org.openqa.selenium.devtools.Connection.sendAndWait(Connection.java:183)
at org.openqa.selenium.devtools.DevTools.send(DevTools.java:89)
at org.openqa.selenium.devtools.idealized.Network.lambda$prepareToInterceptTraffic$5(Network.java:258)
at org.openqa.selenium.devtools.Connection.lambda$handle$4(Connection.java:330)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:442)
Operating System
macOS
Selenium version
4.12.1
What are the browser(s) and version(s) where you see this issue?
Chrome 116
What are the browser driver(s) and version(s) where you see this issue?
Chrome 116
Are you using Selenium Grid?
4.12
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 26 (22 by maintainers)
Hey - the issue seems to be fixed with 4.15. I believe that this was fixed by https://github.com/SeleniumHQ/selenium/commit/5d44d125dfa5f2633a44ab2918eb9a8cb04ac09b. Anyway - happy to close that 😄
Looks good now, i will try to debug into this the next days.