苹果浏览器。无法开始新会话。可能原因是远程服务器地址无效或浏览器启动失败
Safari. Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure
我正在尝试 运行 在 Safari 上进行我的 Selenium 测试。我可以 运行 我在 FireFox 和 IE 上的测试,它工作正常,但在 safari 上不行。
所以可能有人有同样的问题,可以告诉我为什么它不起作用,是的,我已经将 WebDriver 添加到 Safari Extencions:http://prntscr.com/809miw
我有这个错误:
2015-08-03 13:18:57.666:INFO::main: Logging initialized @169ms
[2015/08/03 13:18:57] [ID:69E814D] [Session Start]: Initializing Session...
[2015/08/03 13:18:58] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:58 PM org.openqa.selenium.safari.SafariDriverServer start
INFO: Server started on port 39280
[2015/08/03 13:18:58] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:58 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Launching Safari
[2015/08/03 13:18:58] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:58 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Waiting for SafariDriver to connect
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverChannelHandler operationComplete
INFO: Connection opened
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Driver connected in 980 ms
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Shutting down
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Closing connection
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Stopping Safari
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.os.UnixProcess$SeleniumWatchDog destroyHarder
INFO: Command failed to close cleanly. Destroying forcefully (v2). org.openqa.selenium.os.UnixProcess$SeleniumWatchDog@2038ae61
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Stopping server
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverServer stop
INFO: Stopping server
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Shutdown complete
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Exception in thread "main"
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.46.0', revision: '87c69e2', time: '2015-06-04 16:16:47'
System info: host: 'Vitaliii-PC', ip: '169.254.8.187', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: driver.version: SafariDriver
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:141)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:58)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:51)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at Kodak.AutoTest.Framework.Session.Start(Session.java:117)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at Kodak.AutoTest.QBT.TC93CreateProject.main(TC93CreateProject.java:27)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Caused by: java.lang.ClassCastException: com.google.gson.JsonObject cannot be cast to java.lang.String
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:111)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:42)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.safari.SafariDriverCommandExecutor.execute(SafariDriverCommandExecutor.java:191)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:578)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: ... 7 more
下面是我选择浏览器的方式:
switch(this.type)
{
case IE:
File file = new File(this.config().getParam(ConfigFacade.IEDriverPath_Key));
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
//System.setProperty("webdriver.ie.logfile, ""); // TODO: here somehow redirect log to stream.
this.driver = new InternetExplorerDriver();
break;
case Chrome:
File chromeFile = new File(this.config().getParam(ConfigFacade.ChromeDriverPath_Key));
System.setProperty("webdriver.chrome.driver", chromeFile.getAbsolutePath());
this.driver = new ChromeDriver();
break;
case FireFox:
this.driver = new FirefoxDriver();
break;
case Safari:
this.driver = new SafariDriver();
break;
default:
throw new TestException(String.format("Browser (%1s) is not implemented yet", this.type.toString()));
}
SafariDriver 仅适用于 OS X。正如我从您的日志中看到的,您正试图在 Windows 7 上执行它。
您可以在此处查看支持的操作系统和浏览器:http://docs.seleniumhq.org/about/platforms.jsp
我正在尝试 运行 在 Safari 上进行我的 Selenium 测试。我可以 运行 我在 FireFox 和 IE 上的测试,它工作正常,但在 safari 上不行。 所以可能有人有同样的问题,可以告诉我为什么它不起作用,是的,我已经将 WebDriver 添加到 Safari Extencions:http://prntscr.com/809miw
我有这个错误:
2015-08-03 13:18:57.666:INFO::main: Logging initialized @169ms
[2015/08/03 13:18:57] [ID:69E814D] [Session Start]: Initializing Session...
[2015/08/03 13:18:58] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:58 PM org.openqa.selenium.safari.SafariDriverServer start
INFO: Server started on port 39280
[2015/08/03 13:18:58] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:58 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Launching Safari
[2015/08/03 13:18:58] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:58 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Waiting for SafariDriver to connect
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverChannelHandler operationComplete
INFO: Connection opened
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Driver connected in 980 ms
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Shutting down
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Closing connection
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Stopping Safari
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.os.UnixProcess$SeleniumWatchDog destroyHarder
INFO: Command failed to close cleanly. Destroying forcefully (v2). org.openqa.selenium.os.UnixProcess$SeleniumWatchDog@2038ae61
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Stopping server
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverServer stop
INFO: Stopping server
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Aug 03, 2015 1:18:59 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Shutdown complete
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Exception in thread "main"
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.46.0', revision: '87c69e2', time: '2015-06-04 16:16:47'
System info: host: 'Vitaliii-PC', ip: '169.254.8.187', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: driver.version: SafariDriver
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:141)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:58)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:51)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at Kodak.AutoTest.Framework.Session.Start(Session.java:117)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at Kodak.AutoTest.QBT.TC93CreateProject.main(TC93CreateProject.java:27)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: Caused by: java.lang.ClassCastException: com.google.gson.JsonObject cannot be cast to java.lang.String
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:111)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:42)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.safari.SafariDriverCommandExecutor.execute(SafariDriverCommandExecutor.java:191)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:578)
[2015/08/03 13:18:59] [ID:69E814D] [Selenium]: ... 7 more
下面是我选择浏览器的方式:
switch(this.type)
{
case IE:
File file = new File(this.config().getParam(ConfigFacade.IEDriverPath_Key));
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
//System.setProperty("webdriver.ie.logfile, ""); // TODO: here somehow redirect log to stream.
this.driver = new InternetExplorerDriver();
break;
case Chrome:
File chromeFile = new File(this.config().getParam(ConfigFacade.ChromeDriverPath_Key));
System.setProperty("webdriver.chrome.driver", chromeFile.getAbsolutePath());
this.driver = new ChromeDriver();
break;
case FireFox:
this.driver = new FirefoxDriver();
break;
case Safari:
this.driver = new SafariDriver();
break;
default:
throw new TestException(String.format("Browser (%1s) is not implemented yet", this.type.toString()));
}
SafariDriver 仅适用于 OS X。正如我从您的日志中看到的,您正试图在 Windows 7 上执行它。 您可以在此处查看支持的操作系统和浏览器:http://docs.seleniumhq.org/about/platforms.jsp