SessionNotCreatedException:无法创建新的远程会话。 Appium 1.15.1 Jenkins无法初始化检测过程

时间:2020-03-03 08:19:26

标签: java eclipse selenium jenkins appium

我在使用Jenkins进行自动化测试时遇到问题,我从Jenkins控制台获得了如下错误堆栈跟踪信息:

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:17:03'
System info: host: 'DESKTOP-D0GT2LN', ip: '10.0.20.9', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_221'
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\william tanny\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9)
    at asyncHandler (C:\Users\william tanny\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:388:37)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-D0GT2LN', ip: '10.0.20.9', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_221'
Driver info: driver.version: AndroidDriver
    at Tester.FullTesting.openApps(FullTesting.java:463)
Caused by: java.lang.reflect.InvocationTargetException
    at Tester.FullTesting.openApps(FullTesting.java:463)
Caused by: org.openqa.selenium.WebDriverException: 
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:17:03'
System info: host: 'DESKTOP-D0GT2LN', ip: '10.0.20.9', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_221'
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\william tanny\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9)
    at asyncHandler (C:\Users\william tanny\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:388:37)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Tester.FullTesting.openApps(FullTesting.java:463)

我的Appium版本v1.15.1

当我用eclipse测试我的代码时,它的工作正常。我以为这个错误可能是我重复的称硒。

有人可以帮助我解决这个错误吗?

1 个答案:

答案 0 :(得分:0)

此错误消息...

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:17:03'
System info: host: 'DESKTOP-D0GT2LN', ip: '10.0.20.9', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_221'
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\william tanny\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9)
    at asyncHandler (C:\Users\william tanny\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:388:37)
    at process._tickCallback (internal/process/next_tick.js:68:7)

...表示 AndroidDriver 无法通过 Appium 启动/产生新的浏览上下文


来自服务器端日志(Appium日志)的更多信息将有助于我们以更好的方式分析问题。但是,根据讨论Error: The instrumentation process cannot be initialized,在 v1.11 及更高版本中发现了此问题,在版本 v1.10.1 中存在没有这样的问题。大概服务器端日志(Appium日志)将包含与 UiAutomator2 相关的以下日志消息

[UiAutomator2] 'skipServerInstallation' is set. Attempting to use UIAutomator2 server from the device
[UiAutomator2] Waiting up to 60000ms for UiAutomator2 to be online...
[debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","emulator-5554","shell","am","instrument","-w","io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[debug] [Instrumentation] android.util.AndroidException: INSTRUMENTATION_FAILED: io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner

P可能的原因是 UiAutomator2 没有安装在设备上,或者可能是服务器安装被明确禁用。


解决方案

一个简单的解决方案是在Appium内升级/降级 UIAutomator2 ,但是您不能这样做,因为 UIAutomator2 依赖于其他模块。

因此,解决方案是降级整个Appium软件包。另外,您也可以在运行测试的设备上更改模拟器。有时,从设备上卸载Appium Settings应用并重新启动 Appium 进程即可解决此问题。

相关问题