appium: Unable To Find the PID in Web View on real devices but working fine With Emulator
The problem
I’m trying to perform the actions on webview in android Hybrid app which is built on React native. The same thing working with an emulator but when I’m running it on a real device. Appium is unable to find out the PID.
Getting Below Error:
An unknown server-side error occurred while processing the command. Original error: Failed to start Chromedriver session: An unknown server-side error occurred while processing the command. Original error: unknown error: Failed to get PID for the following process: com.traveltriangle.traveller (process name must be specified if not equal to package name)
Environment
- Appium version that exhibits the issue: Appium v1.14.0, Appium v1.13.0 and Appium v1.12.1.
- Last Appium version that did not exhibit the issue (if applicable): Appium v1.14.0
- Desktop OS/version used to run Appium: Windows 10
- Node.js version (unless using Appium.app|exe): 10.6
- Npm or Yarn package manager: 6.9
- Mobile platform/version under test: 9
- Real device or emulator/simulator: Real Device
- Appium CLI or Appium.app|exe: Both
- APPIUM CHROME DRIVER: LATEST
Details
On Emulator Its working.On real device giving an Error. An unknown server-side error occurred while processing the command. Original error: Failed to start Chromedriver session: An unknown server-side error occurred while processing the command. Original error: unknown error: Failed to get PID for the following process: com.traveltriangle.traveller (process name must be specified if not equal to package name)
Link to Appium logs
https://gist.github.com/tahirakhlaaq/53de659cb5fe89889ab9dec7432c135c
APK Link
https://drive.google.com/open?id=1q1UmVID_m89R8B04Pbk03WeaFBO_UXSV
Code To Reproduce Issue [ Good To Have ]
@BeforeMethod
public void androidCapabilities() throws MalformedURLException {
File f = new File("src");
File fs = new File(f, "app-locators.apk");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("automationName", "uiAutomator2");
cap.setCapability("platformName", "Android");
cap.setCapability("platformVersion", "9");
cap.setCapability("deviceName", "OPPO F11 Pro");
cap.setCapability("appPackage", "com.traveltriangle.traveller");
cap.setCapability("appActivity", "com.traveltriangle.traveller.MainActivity");
cap.setCapability("noReset", true);
String baseURL = "http://0.0.0.0:";
String minorURL = "/wd/hub";
String port = "4723";
driver = new AndroidDriver<AndroidElement>(new URL(baseURL + port + minorURL), cap);
@Test
public void launch() throws InterruptedException, MalformedURLException {
WebDriverWait wait = new WebDriverWait(driver, 10);
Thread.sleep(4000);
waitForElementPresent((MobileBy.
AccessibilityId("ChatBotView_5343_5_FormButton_903_2, ")), 30);
driver.findElement((MobileBy.
AccessibilityId("ChatBotView_5343_5_FormButton_903_2, "))).click();
// driver.findElement(MobileBy.AccessibilityId("CustomFAB_470_2")).click();
Thread.sleep(4000);
Set<String> contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextName);
driver.context(contextName);
if (contextName.contains("WEBVIEW")) {
driver.context(contextName);
}
}
// System.out.println(driver.getPageSource());
waitForElementPresent(By.xpath("(//a[@class='rsc-os-option-element sc-bxivhb PUXvG'])[1]"), 30);
driver.findElement(By.xpath("(//a[@class='rsc-os-option-element sc-bxivhb PUXvG'])[1]")).click();
waitForElementPresent(By.xpath("(//a[@class='rsc-os-option-element sc-bxivhb PUXvG'])[1]"), 30);
driver.findElement(By.xpath("(//a[@class='rsc-os-option-element sc-bxivhb PUXvG'])[1]")).click();
waitForElementPresent(By.xpath("//input[@placeholder='Type your destination...']"), 30);
driver.findElement(By.xpath("//input[@placeholder='Type your destination...']")).sendKeys("cool");
}
public static void waitForElementPresent(final By by, int timeOutInSeconds) {
WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds);
wait.until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
// TODO Auto-generated method stub
return d.findElement(by).isDisplayed();
}
});
}
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (2 by maintainers)
It also confirms the fact that the most of the devices running customized firmwares, that are too different from the stock Android OS (e.g. MiUI), are not good for automated testing.
I thought it’s iOS. then just try the same, but using Chrome remote debugger