1

I need to test multiple separate browser sessions simultaneously (to simulate remote collaboration). This works easily in in Chrome and Firefox but not so in Safari. I keep getting the following error message:

Could not create a session: The Safari instance is already paired with another WebDriver session.

I tried running multiple instances of the standalone Selenium server on different ports but this also did not help:

java -jar selenium-server-standalone-3.141.59.jar -port 4445

And neither did running it from different user accounts. Is there any way I can do this without having to run multiple instances of the full OS?

2 Answers 2

2

Apparently not possible at the moment (or in the near future from the tone of the following statement).
From https://developer.apple.com/documentation/webkit/about_webdriver_for_safari:

One Session at a Time, to Mimic User Interaction

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 windowing environment and prevents tests from competing with each other for window and keyboard focus.

0

One solution that worked for me was to use @fixture annotation and set the scope to function.

from selenium.webdriver import Safari


@fixture(scope='function')
def browser():
    browser = Safari()
    return browser


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.