使用量角器退出的Safari WebDriver setTimeout

时间:2016-04-19 22:21:17

标签: javascript selenium protractor

我使用Karma完成了很多单元测试,但我的办公室希望进行一些集成测试,尤其是测试跨浏览器功能。为此,似乎Protractor是我最好的选择,我已经开始得到一些基本的仪表板测试,但我仍然坚持使用safari。

我的配置:

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('adam+test@mod9.com');
        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);
    }
};

我唯一的规格

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')))
    });
});

错误

[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

有人知道如何为safari配置量角器吗?

1 个答案:

答案 0 :(得分:4)

以下是我成功设置Safari + Protractor所做的工作:

  • 确保我拥有最新的Safari(目前为9.1)
  • this page下载了最新的Safari驱动程序,打开了Safari扩展程序首选项,并将SafariDriver.safariextz文件拖放到扩展程序列表中:

enter image description here

  • protractor升级到最新版本(目前为3.2.2)

请注意,作为替代方案,您始终可以通过BrowserStackSauceLabs远程运行​​Safari。

另请参阅list of Safari+Protractor issues