Comments (5)
@arnonax-tr, thank you for creating this issue. We will troubleshoot it as soon as we can.
Info for maintainers
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template
label.
If the issue is a question, add the I-question
label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted
label.
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable G-*
label, and it will provide the correct link and auto-close the
issue.
After troubleshooting the issue, please add the R-awaiting answer
label.
Thank you!
from selenium.
This issue is obvious.
network.RequestPaused += async (_, args) =>
{
await network.ContinueRequestWithoutModification(args.RequestData);
}
which may lead to System.IO.IOException : Cannot access a closed stream
.
It happens because your async event handler is invoked in background, while main execution program is continuing. And there is a chance that main execution flow disposes driver earlier than your network.ContinueRequestWithoutModification(args.RequestData)
.
This situation is fixed in new BiDi approach (#14318). I have no ideas how to fix it.
Probably making your event handler sync can help (at least please try):
network.RequestPaused += (_, args) =>
{
Task.Run(async () => await network.ContinueRequestWithoutModification(args.RequestData));
}
EDITED:
You may prove my theory via adding a delay in your async handler like await Task.Delay(5_000)
before invocation of network.Continue...
.
from selenium.
And there is a chance that main execution flow disposes driver earlier than your
network.ContinueRequestWithoutModification(args.RequestData).
I don't think so. That's exactly the reason I added the CountdownEvent
object (executingHandlers
). This should ensure that I'm not disposing the driver (or even the DevToolsSession
) before all event handlers are done. (Or if they just start after dispose has already started, they immediately exit due to the if (!executingHandlers.TryAddCount())
statement)
from selenium.
Regarding the BiDi approach: do you have an ETA for when it will be available? Also I'll be grateful if you can provide an example of how my code should look like with that approach.
from selenium.
That's exactly the reason I added the CountdownEvent object (executingHandlers)
Your event handler is async void, selenium invokes (actually schedules your delegate in TaskScheduler to be invoked), and we don't know when exactly your handler is actually invoked. Moreover, in selenium we really fire and forget event handlers. This is design issue, which may lead to unexpected behavior in race conditions. This design issue is addressed in BiDi implementation (or at least should be addressed).
No ETA, PR is under review.
from selenium.
Related Issues (20)
- [🐛 Bug]: Error after updating to Chrome 128 HOT 7
- [🐛 Bug]: Race condition in ruby library for capybara system tests HOT 3
- [🐛 Bug]: Selenium edge driver cannot go to extension page using codes HOT 2
- [🐛 Bug]: eservice HOT 2
- [🐛 Bug]: "--headlessmode=new" with Chromedriver 128 in container results in SessionNotCreatedException HOT 5
- [🚀 Feature]: Make a separate patch release for the patch release artifacts HOT 1
- [🐛 Bug]: The URL transition method does not work. useAutomationExtension HOT 4
- [🐛 Bug]: DefaultSlotMatcher is considering extension capabilities to determine whether the slot matches the requested capabilities HOT 5
- [🐛 Bug]: Node not registering on Hub in the same machine for Client in their office N/W HOT 2
- [🐛 Bug]: Standalone server: "Internal Server Error" when starting new session via HTTP POST HOT 3
- [🚀 Feature]: `Service` shutting down via `__del__` is unintuitive (as `Remote` only consumes the service url) HOT 1
- [🐛 Bug]: Grid is going down everyday and I need to manually restart the hub HOT 5
- [🐛 Bug]: NoAlertPresentException with Selenium Java 4.24.0 and Chrome under enableBiDi HOT 3
- [🐛 Bug]: Is it possible to run Selenium tests in headful mode using GitHub Actions? HOT 4
- [🐛 Bug]:unable to connect to Chrome HOT 4
- [🐛 Bug]: [java] PageFactory.initElements overrides final fields HOT 2
- [🐛 Bug]: Invalid version returned by selenium.__version__ HOT 2
- [🐛 Bug]: Getting timeout error while executing scripts in parallel in Selenium 4.16.1 Grid HOT 2
- [🐛 Bug]: issue in managed download java example HOT 1
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 selenium.