gpt4 book ai didi

java - 如何解决selendroid服务器错误?

转载 作者:行者123 更新时间:2023-12-01 11:50:19 26 4
gpt4 key购买 nike

我尝试使用下面的代码在 Android 模拟器中运行我的测试用例。它抛出下面描述的错误消息。

private WebDriver driver;`
private String baseUrl;

@BeforeSuite
public void setUp() throws Exception {
SelendroidConfiguration config = new SelendroidConfiguration();
config.addSupportedApp("selendroid-test-app-0.14.0.apk");
SelendroidLauncher selendroidServer = new SelendroidLauncher(config);
selendroidServer.launchSelendroid();
SelendroidCapabilities caps = new SelendroidCapabilities("io.selendroid.testapp:0.14.0");
driver = new SelendroidDriver(caps);
baseUrl = "https://www.google.co.in/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testUntitled() throws Exception {
System.out.println("Start Execution.........");
driver.get(baseUrl + "/");
driver.findElement(By.id("gbqfq")).sendKeys("Test");
driver.findElement(By.id("gbqfb")).click();
}
@AfterSuite
public void tearDown() throws Exception {
driver.quit();
}

堆栈跟踪

setUp(mobileweb.photocentric.SampleTest)  Time elapsed: 0 sec  <<< FAILURE!
org.openqa.selenium.SessionNotCreatedException: The requested application under test is not configured in selendroid server.
Command duration or timeout: 207 milliseconds

Driver info: io.selendroid.SelendroidDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
at io.selendroid.SelendroidDriver.<init>(SelendroidDriver.java:61)
at mobileweb.photocentric.ScrollArticleTest.setUp(ScrollArticleTest.java:25)
Caused by: org.openqa.selenium.SessionNotCreatedException: The requested application under test is not configured in selendroid server.

最佳答案

诀窍是,您不必指定要测试的应用程序。

控制-> Guide

尝试:

SelendroidConfiguration config = new SelendroidConfiguration();
selendroidServer = new SelendroidLauncher(config);
selendroidServer.launchSelendroid();
DesiredCapabilities caps = SelendroidCapabilities.android();
driver = new SelendroidDriver(caps);

关于java - 如何解决selendroid服务器错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28847960/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com