gpt4 book ai didi

java - 无法创建新的远程 session 。罂粟属

转载 作者:行者123 更新时间:2023-11-29 00:03:39 24 4
gpt4 key购买 nike

public class StartFirstJobTest {

AppiumDriver driver;
@BeforeTest
public void setUp() throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "F4AZFG07P508");
//capabilities.setCapability("platformName","Android");
//capabilities.setCapability("platformVersion", "5.0");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}

当我尝试运行测试时,出现此错误。

org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{platformName=Android, deviceName=F4AZFG07P508}], required capabilities = Capabilities [{}] Build info: version: '3.3.1', revision: '5234b325d5', time: '2017-03-10 09:10:29 +0000' System info: host: 'MacBook-Pro-Roman.local', ip: 'fe80:0:0:0:77:aef0:77:32%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.3', java.version: '1.8.0_121' Driver info: driver.version: AndroidDriver

我认为我在 appium 中正确设置了所有内容(当检查器启动时,设备已安装应用程序并可以进行测试)

作为项目收集器,我使用 Maven

更新。我正在尝试使应用程序自动化。我在代码中指定了额外的功能

    @BeforeTest
public void setUp() throws Exception {
File app = new File("/Users/romanderabin/Downloads/TimeTracker.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName","F4AZFG07P508");
capabilities.setCapability("platformVersion", "5.0");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.ronasit.timetrackerandroid");
capabilities.setCapability("appActivity","com.ronasit.timetrackerandroid.MainActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4727/wd/hub/"), capabilities);

错误是一样的

org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{app=/Users/romanderabin/Downloads/TimeTracker.apk, appPackage=com.ronasit.timetrackerandroid, appActivity=com.ronasit.timetrackerandroid.MainActivity, platformVersion=5.0, platformName=Android, deviceName=F4AZFG07P508}], required capabilities = Capabilities [{}] Build info: version: '3.3.1', revision: '5234b325d5', time: '2017-03-10 09:10:29 +0000' System info: host: 'MacBook-Pro-Roman.local', ip: 'fe80:0:0:0:77:aef0:77:32%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.3', java.version: '1.8.0_121' Driver info: driver.version: AndroidDriver

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:144) at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:36) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:114) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:132) at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:92) at StartFirstJobTest.setUp(StartFirstJobTest.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138) at org.testng.TestRunner.beforeRun(TestRunner.java:648) at org.testng.TestRunner.run(TestRunner.java:616) at org.testng.SuiteRunner.runTest(SuiteRunner.java:359) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312) at org.testng.SuiteRunner.run(SuiteRunner.java:261) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1191) at org.testng.TestNG.runSuitesLocally(TestNG.java:1116) at org.testng.TestNG.run(TestNG.java:1024) at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72) at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:127) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

Test ignored.

当我尝试开始测试时 Appium 记录

[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/romanderabin/Downloads/TimeTracker.apk","appPackage":"com.ronasit.timetrackerandroid","appActivity":"com.ronasit.timetrackerandroid.MainActivity","platformVersion":"5.0","platformName":"Android","deviceName":"F4AZFG07P508"},"requiredCapabilities":{},"capabilities":{"desiredCapabilities":{"app":"/Users/romanderabin/Downloads/TimeTracker.apk","appPackage":"com.ronasit.timetrackerandroid","appActivity":"com.ronasit.timetrackerandroid.MainActivity","platformVersion":"5.0","platformName":"Android","deviceName":"F4AZFG07P508"},"requiredCapabilities":{}},"alwaysMatch":{"app":"/Users/romanderabin/Downloads/TimeTracker.apk","appPackage":"com.ronasit.timetrackerandroid","appActivity":"com.ronasit.timetrackerandroid.MainActivity","platformVersion":"5.0","platformName":"Android","deviceName":"F4AZFG07P508"},"firstMatch":[]}

[debug] [MJSONWP] Bad parameters: BadParametersError: Parameters were incorrect. We wanted {"required":["desiredCapabilities"],"optional":["requiredCapabilities","sessionId","id"]} and you sent ["desiredCapabilities","requiredCapabilities","capabilities","alwaysMatch","firstMatch"]

[HTTP] <-- POST /wd/hub/session 400 4 ms - 228

最佳答案

我找到了问题的解决方案。将 Appium Java-client 版本 4.1.2 更新到 5.0.0 BETA6 并使用 Selenium-Java 版本 3.3.1

关于java - 无法创建新的远程 session 。罂粟属,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43409349/

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