Skip to content
Advertisement

How to execute selenium script in a lot of threads?

I like to test my site in a lot of threads. But when I trying to do that, I see one problem. All motions when I like are happening in last opened window. So, the first window just stuck in background.

JavaScript

I really don’t understand why it happens. You can see it here. After that the code has run, the first window keeps hanging in back. It don’t close. When the second thread closes after executing code

Advertisement

Answer

This is because of you using static field for Forefox driver.

Static means the one per all instances. So remove static here.

JavaScript

and after, each thread will use it’s own firefoxDriver field.

Static fields should be used carefully if you going to modify them.

Advertisement