问题
I have around 1600 java TCs written using selenium. While executing test scripts in parallel (say thread count = 5), I am able to trigger 5 safari webdrivers and scripts are executing parallel.
But, when the 6th (threadcount +1) script gets invoked, it is throwing below exception:
Could not create a session: The Safari instance is already paired with another WebDriver session.
I am quitting and closing the webdriver session after each test case. The same piece of code is working fine for other browsers except safari.It should run on the same machine with 5 instances running parallel.
回答1:
My expectation is that you're hitting default maxSession
limit of 5
browser instances.
You can double check it by opening your Selenium Grid console and looking into node configuration:
The value can be ramped up by providing the relevant maxSession
parameter to your Selenium Grid Node startup command line like:
java -jar selenium-server-standalone-3.141.59.jar -role node -maxSession 10 -hub http://localhost:4444/grid/register
^^^^^^^^^^^^^^
References:
- Selenium Grid
- Selenium Grid - Configuring the nodes - Optional Parameters
- How to run your Selenium tests in Distributed Test Execution Environments
来源:https://stackoverflow.com/questions/57670744/unable-to-perform-parallel-execution-on-safari-on-mac-using-selenium