gpt4 book ai didi

java - 无法创建新的远程 session (Appium java 13)尝试启动应用程序

转载 作者:行者123 更新时间:2023-12-01 23:17:53 26 4
gpt4 key购买 nike

这是我的代码。我是 Appium 的初学者,我正在使用 Java 版本 13 以及最新版本的 Eclipse 和 Appium,我已经尝试了所有方法,但每次我都会遇到以下异常:

FAILED: run org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output. Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'LAPTOP-044PA886', ip: '192.168.86.221', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '13' Driver info: driver.version: AndroidDriver remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output. at getResponseForW3CError (C:\Users\Team Quality\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:826:9) at asyncHandler (C:\Users\Team Quality\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:388:37) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'

这是我的代码:

    public static void run() throws MalformedURLException {
// TODO Auto-generated method stub


//System.setProperty("webdriver.chrome.driver", "C:\\Users\\Team Quality\\Downloads\\chromedriver_win32\\chromedriver.exe");
//WebDriver driver = new ChromeDriver();
// driver.get("http:\\www.easports.com");

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "818cec5");
cap.setCapability("platformName","Android");

cap.setCapability("appPackage", "com.xxx");
cap.setCapability("appActivity","com.xxx.xxx.activities.SplashActivity");

System.out.println("code executed till here");


cap.setCapability(MobileCapabilityType.APP, "C:\\Users\\Team Quality\\eclipse-workspace\\Intro\\src\\tkstage.apk");

System.out.println("code executed till here2");
//AndroidDriver<AndroidElement> driver =new AndroidDriver<AndroidElement> (new URL("http://localhost:4723/wd/hub"),cap);
//driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);
//driver.get("http://appium.io/");

try {
AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), cap);

} catch (MalformedURLException e) {
System.out.println(e.getMessage());
}

System.out.println("code executed till here3");
}

最佳答案

您的设备上安装了该应用程序吗?如果没有,请提供 app 功能以及 .apk 文件的路径。再次检查您的 appPackageappActivity 功能。您可以使用 Apk 分析器应用程序来确保您的值正确

关于java - 无法创建新的远程 session (Appium java 13)尝试启动应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58342224/

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