Appium:收到错误“无法启动Chromedriver会话,原始错误:未知错误:无法获取以下过程的PID"" [英] Appium: Getting error "Failed to start Chromedriver session, Original error: unknown error: Failed to get PID for the following process"

查看:404
本文介绍了Appium:收到错误“无法启动Chromedriver会话,原始错误:未知错误:无法获取以下过程的PID""的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我测试Android构建内部"样式时遇到此错误,我认为问题是我们的Android应用程序构建的程序包和进程名称不匹配,而由于内部"而更改了程序包名称时,可能会发生这种情况味道.我仍在寻找解决方法,可以在这里以及在网上搜索时找到任何相关案例.我将继续寻找并尝试修复,但是如果有人有想法或解决方案,请继续.让我知道.

Got this error when I tested an Android build "internal" flavor, I believe the problem is a mismatch in package and process name of our Android application build which could have to happen when the package name changed due to the "internal" flavor. I'm still looking into how to fix this and I can find any relevant cases here and while searching on the web. I'll keep looking and trying fixes but if anyone has an idea or solution pls. let me know.

推荐答案

发现:事实证明,Android为每个不同的风味"构建都创建了新的程序包名称,请参见

Findings: Turns out that Android creates a new package name for every different "flavor" build, see https://developer.android.com/studio/build/build-variants but retain the processName. In our case, it added "internal" on package name ex. com.xxxx.android.internal while processName remains com.xxxx.android.

问题:问题的根源是当您切换到Webview上下文时,Appium将某些功能传递给了ChromeDriver,其中包括packageName,但是当它尝试发出adb命令来查找该进程时却找不到因为不匹配而找到它.

Issue: The root of the issue is when you switch to webview context, Appium pass certain capabilities to ChromeDriver including packageName but when it tried to issue an adb command to find the process it can't find it because of a mismatch.

解决方案:使用chromeOptions功能传递processName,请参见下面的Java代码.

Solution: Use chromeOptions capability to pass the processName, see code below in java.

Map<String, Object> chromeOptions = new HashMap<String, Object>();
chromeOptions.put("androidProcess", "com.xxxx.android"); 
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);

这篇关于Appium:收到错误“无法启动Chromedriver会话,原始错误:未知错误:无法获取以下过程的PID""的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆