Это сообщение об ошибке ...
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) помогла бы нам лучше проанализировать проблему. Тем не менее, в соответствии с обсуждением Ошибка: процесс инструментирования не может быть инициализирован эта проблема наблюдается с appium 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
PT Возможная причина: UiAutomator2 не установлен на устройстве или может быть установка сервера явно отключена.
Решение
Более простым решением было бы обновить / понизить версию UIAutomator2 внутри Appium, но вы не можете этого сделать, поскольку UIAutomator2 зависит от других модулей.
Итак, решение состоит в том, чтобы понизить версию всего пакета Appium. В качестве альтернативы вы можете изменить эмулятор / симулятор на устройстве, на котором вы выполняете свои тесты. Иногда удаление приложения Appium Settings
с устройства и перезапуск процесса Appium также решают проблему.