0

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.

hnayan
  • 1
  • 1
  • 1
    Are you sure you are able to create 5 safari sessions parallel? As safari does not support parallel session – V_K Aug 27 '19 at 09:59
  • yes..I am able to create 5 instances of safari driver in single machine and all 5 run parallel.However,the 6th script is not getting picked up – hnayan Aug 27 '19 at 10:50
  • Hi @hnayan could you please help me with the Setup details that you used to run the parallel safari in one machine – Rohit Aug 29 '21 at 22:15

2 Answers2

0

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:

enter image description here

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:

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
0

It's an old question, but in case anyone comes across it, please read official apple website:

https://developer.apple.com/documentation/webkit/about_webdriver_for_safari

Only one Safari browser instance can be active at any given time, and only one WebDriver session at a time can be attached to the browser instance. These constraints ensure that the simulated behavior (mouse, keyboard, touch, and so forth) accurately reflects what a user can do in a macOS

At the moment, safari does not support parallel execution. It would only be possible if you ran them each inside their own containers (with one Safari instance running inside each container)

I too, thought I had 5 parallel Safari sessions running localy at first, but when you watch them, they only execute one at a time, changing maxSession will not fix this

-- I hope this helps someone