Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to connect to SafariDriver (Safari 10)

I'm getting 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

capability:

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

Do we need a specific safari driver for this? If yes, where can I get it from and where should it be declared in the .conf file.

Thank you!

like image 394
CodeJockey Avatar asked Jan 06 '17 19:01

CodeJockey


People also ask

Does Selenium work on Safari?

Yes Selenium webdriver supports Safari browser. Safari is a prominent browser and is provided by default by Apple devices. For Safari versions 10 and greater than 10, the safaridriver comes automatically and is not required to be installed separately. The location of the SafariDriver is: /usr/bin/safaridriver.

How do I run Selenium scripts in Safari?

How do I automate Safari browser using Selenium? Step 1: Download and Install the Safari Browser Extension. Step 2: Enable the WebDriver Browser Extension by going to Safari > Preferences and open the preferences window and then enable the “Enable WebDriver“ option. Step 3: Restart your Browser.

Does Safari have a WebDriver?

Safari's driver is called safaridriver and has a preset available in most Selenium client libraries. You can write tests in Python, Java, PHP, JavaScript, and any other language whose library is compatible with the W3C WebDriver protocol. WebDriver is a REST API.


1 Answers

Yes, you need to install a specific safari driver in order to launch it inside of protractor. And of course, you need to be on a mac. 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:

  1. Download the safari plugin from here.
  2. Run the plugin
  3. Select "Trust" the plugin when prompted by safari

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

This is the driver for Selenium 2.48. I couldn't find a more recent build, so if this driver version doesn't run with the current version of Protractor, you will need to either use an older version of protractor that is based on Selenium 2.48 or build the safari driver from source.

like image 74
Andrew Eisenberg Avatar answered Sep 17 '22 20:09

Andrew Eisenberg