Appium安装错误:无法启动新会话。可能的原因是远程服务器的无效地址或浏览器启动失败

时间:2015-07-02 12:03:09

标签: appium

我是初学者并安装了appium来运行eclipse中的selenium脚本。我也尝试了与app路径相同的代码

/ Users / 路径 .app

我用检查员启动了appium,然后执行了上面的代码。我最终得到以下错误

Exception in thread "main" 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:17:10'
System info: host: 'vishal.local', ip: '192.168.1.16', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.3', java.version: '1.8.0_40-ea'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:155)
    at catietest.CatieTest.setUp(CatieTest.java:34)
    at catietest.CatieTest.main(CatieTest.java:18)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to 0.0.0.0:4723 [/0.0.0.0] failed: Connection refused
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
    at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:143)
    at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:134)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:578)
    ... 5 more
Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:204)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
    ... 18 more

我还尝试将appDir路径更改为&#34; / Users / 路径 / Debug-iphonesimulator&#34;

即便如此,我也遇到了同样的错误。

请给我一个解决方案

1 个答案:

答案 0 :(得分:0)

确保您已将selenium stand alone jar添加到项目参考罐中。

如果您在iOS上执行测试用例,请确保您指向http://0.0.0.0:4723/wd/hub

如果您在Android上执行测试用例,请确保它指向https://127.0.0.1:4723/wd/hub

在启动appium服务器之前,请确保已通过命令设置ANDROID_HOME环境变量:

Apples-MacBook-Pro-2:~apple $ export ANDROID_HOME =“/ usr / local / Cellar / android-sdk / 24.4.1_1”

然后启动appium服务器并执行测试。