helium
helium copied to clipboard
Running multiple instances in parallel
I've been using Selenium to run multiple browser windows in parallel. To do this I would simply start a new Chrome instance and place all the driver references into a list. I then send each instance to a thread to run through its instructions. However, it doesn't seem like this is possible with Helium as, as far as I can tell, there is just one global Helium instance and I need to set the driver before executing the command. However, when I run this in multiple threads, the wrong commands get called.
Is there to have multiple instances of Helium at one time?
The easiest solution would be to use a multiprocess pool so that every process gets its only instance of helium.
Another way to do it would be to extend from the base implentation class class APIImpl:
from helium/_impl/__init__.py
and have that create an instance for every thread. I tried this once but I had problems with the wrappers around html elements like Link, CheckBox, Image
from their respective classes LinkImpl,CheckBoxImpl,ImageImpl
since they use the global require_driver()
that gives you the single instance.
@dntzbgh is right. Helium unfortunately does not (really) support having multiple Selenium WebDrivers that are used in parallel. He's further right that to fix this, one would have to change / extend APIImpl
.
It should not be too hard to implement this, but I won't have time to do it. So if you @TheBestMoshe, @dntzbgh or someone else want this feature, you'd need to implement it yourself and submit a PR. I'd be happy to merge such change. But like I said, I will not have time to do the implementation.
Does anyone have updates on this? It would be essential to me to run multiple helium drivers in the same program..
@iFedix feel free to implement and submit a PR 👍