在Sauce Labs上针对Safari浏览器运行实习测试的正确配置是什么

时间:2015-09-28 20:45:19

标签: selenium safari intern saucelabs

基于https://docs.saucelabs.com/reference/platforms-configurator/,将实习生配置配置为针对Safari浏览器运行功能测试:

      environments : [ {
                    "browserName" : "safari",
                    platform : [ "OS X 10.9" ],
                    version: "7.0"
                } ],

但是,测试不会启动并且会引发错误:

SUITE ERROR
UnknownCommand: [POST http://(redacted)@localhost:1290/wd/hub/session/    
{"desiredCapabilities":{"browserName":"safari","platform":"OS X   
10.9","version":"6","tunnel-identifier":"1443465925611","selenium-  
version":"2.46.0","command-timeout":360,"idle-timeout":180}}] The requested 
resource could not be found, or a request was received using an HTTP method 
that is not supported by the mapped resource.
at Server.createSession  <node_modules/intern/node_modules/leadfoot  
/Server.js:307:15>
at <node_modules/intern/lib/executors/Runner.js:174:22>
at retry  <node_modules/intern/lib/util.js:695:13>
at <node_modules/intern/node_modules/dojo/Promise.ts:393:15>
at runCallbacks  <node_modules/intern/node_modules/dojo/Promise.ts:11:11>
at <node_modules/intern/node_modules/dojo/Promise.ts:317:4>
at run  <node_modules/intern/node_modules/dojo/Promise.ts:237:7>
at <node_modules/intern/node_modules/dojo/nextTick.ts:44:3>
at process._tickCallback  <node.js:355:11>

2 个答案:

答案 0 :(得分:1)

所需的能力&#34;平台&#34;如果值未包含在括号中,则应该有效。以下是适用于Safari版本7的OSX 10.9的一组功能。

  environments : [ {
                "browserName": "safari",
                "platform": "OS X 10.9",
                "version": "7.0"
            } ],

答案 1 :(得分:0)

我是这样做的:

DesiredCapabilities capabilities = DesiredCapabilities.safari();
capabilities.setCapability("safari.cleanSession", true);

SafariOptions safariOptions = new SafariOptions();
safariOptions.setUseCleanSession(true);
capabilities.setCapability(SafariOptions.CAPABILITY, safariOptions);

//For Sauce
capabilities.setCapability("platform", "OS X 10.11");
capabilities.setCapability("version", "9.0");

webdriver = new RemoteWebDriver(sauceURL, capabilities);