当我尝试运行我的代码时:
import static org.junit.Assert.*;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;
public class desiredcapab {
@Test
public void test() throws MalformedURLException {
File appDir =new File("src");
File app = new File(appDir, "Piano Tiles 1_7.apk");
DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android_Emulator");
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
AndroidDriver driver =new AndroidDriver(new URL("https://127.0.0.1:4723/wd/hub"),cap);
}
}
作为JUNIT测试,我收到以下错误:
org.openqa.selenium.remote.UnreachableBrowserException:不能 开始一个新的会议。可能的原因是遥控器的无效地址 服务器或浏览器启动失败。构建信息:版本:' 2.47.1', 修订版:' 411b314',时间:' 2015-07-30 02:56:46'系统信息:主持人: ' FUEL091',ip:' 172.17.64.88',os.name:' Windows 7',os.arch:' amd64', os.version:' 6.1',java.version:' 1.8.0_51'司机信息: driver.version:AndroidDriver at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:589) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180) 在 org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242) 在 org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:128) 在 org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:155) 在io.appium.java_client.AppiumDriver。(AppiumDriver.java:109) 在 io.appium.java_client.android.AndroidDriver。(AndroidDriver.java:39) 在desiredcapab.test(desiredcapab.java:30)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)at sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)at java.lang.reflect.Method.invoke(未知来源)at org.junit.runners.model.FrameworkMethod $ 1.runReflectiveCall(FrameworkMethod.java:50) 在 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 在 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) 在 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) 在org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) 在 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) 在org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:290)at at org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:71)at at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)at at org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:58)at at org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:268)at at org.junit.runners.ParentRunner.run(ParentRunner.java:363)at at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) 在 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) 引起:javax.net.ssl.SSLHandshakeException:远程主机关闭 在握手期间的连接 sun.security.ssl.SSLSocketImpl.readRecord(未知来源)at sun.security.ssl.SSLSocketImpl.performInitialHandshake(未知来源) 在sun.security.ssl.SSLSocketImpl.startHandshake(未知来源)at sun.security.ssl.SSLSocketImpl.startHandshake(未知来源)at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394) 在 org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353) 在 org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134) 在 org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) 在 org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) 在 org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) 在 org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) 在 org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) 在 org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) 在 org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) 在 org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71) 在 org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55) 在 org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:143) 在 org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89) 在 org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:134) 在 org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:568) ... 30更多引起:java.io.EOFException:SSL对等关闭 sun.security.ssl.InputRecord.read(未知来源)错误... 50多个
答案 0 :(得分:0)
好的,所以我想出来了,我花了几分钟来调试这个。在向驱动程序提供URL时将HTTPS://更改为HTTP。