Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Safari WebDriver setTimeout using protractor exiting

I have done a lot of unit tests using Karma, but my office would like to have some integration tests, especially testing cross browser capabilities. For this, it seemed Protractor was my best option, and I have started get get some basic dashboard tests going, but am stuck with safari.

My Config:

exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub',

    specs: ['scenarios/*Scenario.js'],

    framework: 'jasmine',

    baseUrl: 'https://www-dev.remeeting.com/',

    multiCapabilities: [{
        browserName: 'firefox'
    }, {
       browserName: 'chrome'
    }, {
       browserName: 'safari'
    }],

    onPrepare: function() {
        browser.driver.get('https://www-dev.remeeting.com/');

        browser.driver.findElement(by.id('email')).sendKeys('[email protected]');
        browser.driver.findElement(by.id('password')).sendKeys('abc123');
        browser.driver.findElement(by.id('submit_btn')).click();

        // Login takes some time, so wait until it's done.
        // For the test app's login, we know it's done when it redirects to
        // app/#/d.
        return browser.driver.wait(function() {
            return browser.driver.getCurrentUrl().then(function(url) {
                return /app\/#\/d/.test(url);
            });
        }, 10000);
    }
};

My only spec

describe('Dashboard', function() {
    it('should login to the dashboard', function() {
        expect(element(by.css('.dashboard')).getText()).toMatch(/Upload Meeting/);
        expect(element(by.id('refreshButton')));
        expect(element(by.css('.dashboard div.btn-group')))
    });
});

And the error

[safari #21] PID: 79079
[safari #21] Specs: /Users/adam/git/mrp-  www/e2e/scenarios/dashboardScenario.js
[safari #21]
[safari #21] Using the selenium server at http://localhost:4444/wd/hub
[safari #21] ERROR - Unable to start a WebDriver session.
[safari #21] Unknown command: setTimeout (WARNING: The server did not provide any stacktrace information)
...
[safari #21] Driver info: org.openqa.selenium.safari.SafariDriver
[safari #21] Capabilities [{browserName=safari, takesScreenshot=true, javascriptEnabled=true, version=9.1, cssSelectorsEnabled=true, platform=MAC, secureSsl=true}]
[safari #21] Session ID: null

[launcher] Runner process exited unexpectedly with error code: 1
[launcher] 2 instance(s) of WebDriver still running

Anybody know how to configure protractor for safari?

like image 815
AdamCooper86 Avatar asked Apr 19 '16 22:04

AdamCooper86


1 Answers

Here is what I did to successfully set up Safari + Protractor:

  • made sure I have the latest Safari (9.1 at the moment)
  • downloaded the latest Safari driver from this page, opened the Safari extensions preferences and dragged and dropped the SafariDriver.safariextz file into the extension list:

enter image description here

  • upgraded protractor to the latest version (3.2.2 at the moment)

Note that, as an alternative, you can always run Safari remotely on BrowserStack or SauceLabs.


See also the list of Safari+Protractor issues.

like image 78
alecxe Avatar answered Nov 01 '22 17:11

alecxe