Failed to connect to SafariDriver (Safari 10)

I get the following error when running my protractor test on mac for safari

Failed to connect to SafariDriver after 10082 ms Build info: version: '2.53.1', revision: 'a36b8b1', os.arch: 'x86_64', os.version: '10.12.2', java.version: '1.8.0_101' Driver info: driver.version: SafariDriver 

Capabilities:

  name: 'Safari', browserName: 'safari', logName: 'Safari', shardTestFiles: true, maxInstances: 2 

Does this require a special safari driver? If so, where can I get it from and where should it be declared in the .conf file.

Thanks!

+6
source share
2 answers

Yes, you need to install a specific Safari driver to run it inside the protractor. And of course you need to be on mac. A protractor is essentially a layer built on top of Selenium , so you need to install the selenium driver for Safari, which is implemented as a Safari plugin.

Here is what you need to do:

  • Download the Safari plugin from here .
  • Run the plugin
  • Select "Trust" the plugin when prompted with safari

The driver is now installed and should be available for your protractor process.

This is the driver for Selenium 2.48. I could not find a newer assembly, so if this version of the driver does not work with the current version of Protractor, you need to either use an older version of the protractor, which is based on Selenium 2.48, or build a safari driver from the source.

+3
source

First of all, starting with Safari 10, Safari comes with a new driver version. The old driver (extension) is out of date. You are using macOS 10.12.2, so this is your case. To enable the new driver in Safari, select the Allow remote automation check box in the Design menu. If you do not have this menu, enable it: Settings> Advanced> Show "Development" menu in the menu bar. Run /usr/bin/safaridriver once manually to give it the necessary permissions.

Secondly, you need version 3.0 for a standalone Selenium server, not 2.53.1. The command to install it:

 sudo webdriver-manager update --versions.standalone 3.0.1 

To get started:

 webdriver-manager start --versions.standalone 3.0.1 

Thirdly, the visibility check in the new driver is violated. Therefore, things like browser.wait(ExpectedConditions.visibilityOf(myElement), 5000); , do not work, and lead to an UnsupportedCommandException . To fix this, you can try installing Safari Technology Preview and run the tests there (add 'safari.options': { technologyPreview: true } to the features). But for me, the preview works even worse than the release. The protractor says they cannot find Angular on the page because they changed window.name to clear after cross navigation in Release 19 . If you are fortunate enough to find a way to make it work, please let me know.

Below are some links that you should check because I might have missed something.

+3
source

Source: https://habr.com/ru/post/1013844/


All Articles