Appium: Getting error “Failed to start Chromedriver session, Original error: unknown error: Failed to get PID for the following process”

你离开我真会死。 提交于 2020-01-06 13:14:25

问题


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.


回答1:


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.

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.

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);


来源:https://stackoverflow.com/questions/52429593/appium-getting-error-failed-to-start-chromedriver-session-original-error-unk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!