Unable to switch to web view in hybrid app.
See original GitHub issueThe problem
Hi, I am trying to switch to web context from native and then switch back. However it throws an error at me which I have tried to solve with solutions found online but nothing seems to be working. The code flow is to click an element within the native context which then redirects to a webpage to approve authentication and then return back to the native context.
The error is thrown by:
driver.context((String) contextNames.toArray()[1]);
which is:
[Chromedriver] Error: Failed to start Chromedriver session: An unknown server-side error occurred while processing the command. (Original error: unknown error: Failed to get sockets matching: @webview_devtools_remote_.*23686
My code chunk is:
` wait.until(ExpectedConditions.visibilityOfElementLocated (By.id(“com.android.chrome:id/location_bar”)));
Set<String> contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextNames);
}
driver.context((String) contextNames.toArray()[1]);
System.out.println("Expected chrome: "+driver.getContext());
WebView.setWebContentsDebuggingEnabled(true);
driver.findElement(By.xpath("/html/body/div[1]/div[4]/div/div/div[4]/a[1]")).click();
driver.context("NATIVE_APP");
`
as well as in my capabilities I have the following:
` capabilities.setCapability(“appium-version”, “1.7.2”);
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", deviceName);
capabilities.setCapability("appPackage", "de.codenauts.hockeyapp");
capabilities.setCapability("appActivity","net.hockeyapp.client.HomeActivity");
capabilities.setCapability("setWebContentsDebuggingEnabled","true");
`
Environment
My Appium version is 1.7.2 The mobile device is running chrome 65.0.3325.109 The chromedriver version I have is 3.38 node version v8.10.0 Android 6.01, real device: LG-k557
Link to Appium logs
The Logs can be found here: https://gist.github.com/mmaxin/6cdf8cc14c372ed763b9e41599f88494
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (1 by maintainers)
Top GitHub Comments
I am also facing the same:
Same issue here: