question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable To Find the PID in Web View on real devices but working fine With Emulator

See original GitHub issue

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

@mykola-mokhnach

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mykola-mokhnachcommented, May 27, 2020

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.

1reaction
mykola-mokhnachcommented, Aug 19, 2019

I thought it’s iOS. then just try the same, but using Chrome remote debugger

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android emulator-5554 offline - Stack Overflow
In eclipse, go to Window>Android Virtual Device Manager, click on the AVD you want to launch, click on start and uncheck "Launch From...
Read more >
Getting Started with Frida - Medium
From desktop terminal, we can connect frida-server by using the below command: If everything works fine for you, it will give you the...
Read more >
Install, configure and integrate Local Emulator Suite - Firebase
Start an emulator initialization wizard. Identify emulators to be installed and optionally specify emulator port settings. init emulators is non-destructive; ...
Read more >
Can't find elements on a webview page of an android Native ...
I am not able to find the elements from android.webkit.WebView in my native app. As you can see in the uiautomatorviewer, I am...
Read more >
Unable to attach to pid error | Apple Developer Forums
Unhook your device, plug it back in and usually that fixes it. You could also try going to Product (hold down Option Key)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found