selene
selene copied to clipboard
use pytest-parallel thread rather than process
selene does not support thread concurrency for automation execution
It should support anything, because you can create your own browser for any case.
Selene has shared browser object, already predefined for you, that you can import as:
from selene import browser
or (may be deprecated)
from selene.support.shared import browser
This browser uses 1 global shared per process driver instance. Hence, of course, it will not work if you paralellize per thread.
But you can create in each thread - your own browser by
from selene import Browser, Config
browser = Browser(Config(driver=..., **other_options))
Then everything should be fine...
Should we improve the behavior of shared browser object? Hm... Probably yes, if this is not a big deal. Let's investigate this topic... If somebody can help with this, prepare examples, share some snippets, would be great...
I also used selenide before because some testing scenarios require threads to share some data, such as testing scenarios where I need two browsers to interact. Therefore, relying on thread concurrency is not very suitable for process concurrency
The thread concurrency provided by the Java testng framework
However, selenide also has issues with thread concurrency, as it does not want to be thread safe during thread concurrency
Add posibility to set different capabilities for each browser session in Configuration class
Add posibility to set different capabilities for each browser session in Configuration class
This will come pretty soon, in Selene 2.0.0rc1. Currently in "work in progress". Tills this will be done, you can create your own driver based on capabilities and pass it eather browser.config.driver = HERE
or browser = Browser(Config(driver=HERE))
where I need two browsers to interact
For this case, currently, in Selene you just create the needed amount of browsers by browser2 = Browser(Config(driver=driver2)); browser3 = Browser(Config(driver=driver3)); # and so on...
Regarding thread concurrency in Python... I'll think what we can do for this in Selene in context of adapting shared selene browser object (the one from: from selene import browser
)... We never looked into this, because in Python thread-like parallisation is not efficient like in Java, and everybody used process-like parallisation... Let's see... maybe something changed, or maybe there are some use cases in context of test automation where thread-like concurrency make sense... If you share some actualy use cases with code snippets, it would help! Thank you!