❔ I need help making my code threadsafe that uses Selenium webdriver.
I am currently working on a service worker where i user selenium to take screenshots and the process for taking the screenshots is a multthreaded solutions where i use a Parallel.ForEach- loop with 4 or more threads on each round in the loops.
in the loops i am createing a chrome driver and a ChromeDriverService for the driver.
The service worker is installed as a windows service and it generates the following error after sometime after running perfectly fine.
I need help stabilizing the code.
7 Replies
How have you determined that this is a thread safety issue?
@Deno This i a great question, the reason why i belive this is mostly due to th errors I have recieved.
line 260 is the last on the last line of my parallel.foreach loop. I belive the threads are targeting the same port and causing this.
And why are you using parallel for each, when you have Async methods?
Is there any issues running async on parallel? I wanted multiple instances of chromedriver to run simultaneously
I just find it strange to use that when you have Task.WhenAll
Stack Overflow
Nesting await in Parallel.ForEach
In a metro app, I need to execute a number of WCF calls. There are a significant number of calls to be made, so I need to do them in a parallel loop. The problem is that the parallel loop exits be...
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.