0

When trying to open Multiple instances of Safari for example in test cases when trying to open new window selenium is giving SessionNotCreatedException-

org.openqa.selenium.SessionNotCreatedException: Could not create a session: The Safari instance is already paired with another WebDriver session.
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
Ashish Kamble
  • 2,555
  • 3
  • 21
  • 29
pkhauzhal
  • 27
  • 2
  • 9

2 Answers2

0

It seems like it is not supported at the moment.

The Safari driver explicitly only supports one instance at a time. It's a current limitation of the driver.

https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/7042

kamentk
  • 513
  • 3
  • 12
  • 1
    is it possible to instantiate safaridriver on 2 different ports? – pkhauzhal Nov 01 '18 at 10:27
  • @pkhauzhal, I did try that by starting two different safari nodes with random ports. But when send two tests at once, at the 1st attempt, one test get passed and the other fails with the exception "org.openqa.selenium.WebDriverException: Error forwarding the new session Error forwarding the request timeout". There onwards, both tests fail. – Panduka Sep 22 '20 at 21:16
0

I am getting this error. Not sure what the solution is, but I do notice that after trying to run once, there are multiple safari processes left over:

JAUSTEN-M1:scripts jausten$ ps -ef | grep safari
  502  5243  1629   0  9:50AM ttys001    0:00.00 grep safari
  502  5202  3635   0  9:49AM ttys003    0:00.04 /System/Library/CoreServices/SafariSupport.bundle/Contents/MacOS/safaridriver --port 34851
  502  5206  3635   0  9:49AM ttys003    0:00.04 /System/Library/CoreServices/SafariSupport.bundle/Contents/MacOS/safaridriver --port 16102
  502  5210  3635   0  9:49AM ttys003    0:00.04 /System/Library/CoreServices/SafariSupport.bundle/Contents/MacOS/safaridriver --port 33731
  502  5214  3635   0  9:49AM ttys003    0:00.04 /System/Library/CoreServices/SafariSupport.bundle/Contents/MacOS/safaridriver --port 21247
  502  5218  3635   0  9:49AM ttys003    0:00.04 /System/Library/CoreServices/SafariSupport.bundle/Contents/MacOS/safaridriver --port 28780
  502  5222  3635   0  9:49AM ttys003    0:00.04 /System/Library/CoreServices/SafariSupport.bundle/Contents/MacOS/safaridriver --port 4727
JAUSTEN-M1:scripts jausten$ pkill safaridriver
JAUSTEN-M1:scripts jausten$ ps -ef | grep safari
  502  5262  1629   0  9:50AM ttys001    0:00.00 grep safari

I don't understand why this would be the case unless it is a bug in my automation framework.

djangofan
  • 28,471
  • 61
  • 196
  • 289