詳細運行測試用例:如何在Safari硒網格與Windows 10機如輪轂及MAC機器作爲節點
Windows版本: 10中,64位
MAC: MACOS塞拉利昂10.12 0.5
Safari瀏覽器: 10.1.1
硒: 3.4.0
Windows機器上發起者轂具有低於命令和啓動成功
java -jar selenium-server-standalone-3.4.0.jar -role hub -port 4444
MAC計算機上啓動節點與下面的命令和啓動成功
java -jar selenium-server-standalone-3.4.0.jar -role node -nodeConfig mac.json
mac.json含量是
{
"capabilities":
[
{
"browserName": "safari",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "firefox",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "chrome",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "internet explorer",
"maxInstances": 1,
"seleniumProtocol": "WebDriver"
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 5,
"port": 5555,
"register": true,
"registerCycle": 5000,
"hub": "http://192.101.3.23:4444",
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
Selenium調用瀏覽器的Java代碼是
capability = DesiredCapabilities.safari();
capability.setBrowserName("safari");
capability.setPlatform(Platform.MAC);
SafariOptions options = new SafariOptions();
options.setUseCleanSession(true);
capability=DesiredCapabilities.safari();
capability.setCapability(SafariOptions.CAPABILITY, options);
capability.setPlatform(Platform.ANY);
driver=new RemoteWebDriver(new URL(http://192.101.1.23:5555),capability);
上執行下面的線爲Safari瀏覽器
driver=new RemoteWebDriver(new URL(http://192.101.1.23:5555),capability);
拋出異常
java.lang.reflect.InvocationTargetException
我無法繼續,我是不是錯過了什麼,究竟是不是讓我繼續下去,任何人都可以幫忙。
更新了硒Java代碼的下方,做工精細
capability = DesiredCapabilities.safari();
driver=new RemoteWebDriver(new URL(http://192.101.1.23:5555),capability);
感謝您的答覆。在mac.json和Java代碼中定義的功能導致該問題,Java代碼中的功能被刪除,並且工作正常。 – SeJaPy
@Aparna - 您可能想回答您的問題,然後接受它,以便問題可以關閉。 –