Unable to pick up multiple webviews on Android


I’m looking for some help with an issue I’m having automating a hybrid Android app. I’m unsure if this a bug with Appium or an issue with what I’m doing.

A page of our app has several webviews, one for an advert, and several others displaying content, however when I run driver.getContextHandles, I am only getting “NATIVE_APP” and one “WEBVIEW_”. When looking at the pageSource for the returned webview, and comparing it to what I can see in Chrome dev tools when inspecting devices, it appears that Appium is picking up the first webview from the list in Chrome, but none of the others

Has anyone else experienced a similar issue?

1 Like

I did before and it turned out that Chrome remote debugging doesn’t differentiate between WEBVIEWS and Window handles. Check inside the webview for available window handles.

Thanks Hassan, I’ll try that out

That works successfully, thanks very much for the help Hassan

Dear @Hassan_Radi & @jonhw: Can u give a brief on this work-around??

Switch to webview using the following command:

driver.context(“webview name”);

get all window handles using the following command:


Use the list of returned window handles and switch to the requested window using the following command:

driver.switchTo().window(“window name”);

This does get a bit more complicated if trying to establish anything about the windows. For example, several of the available webviews in our app have the same name. The best way to establish the correct webview would be using


However, this results in an error:

unknown error: command only supported for desktop Chrome without debuggerAddress

From googling the error, it seems this is shown generally for window interactions that Appium no longer supports since the switch to contexts in 1.0. It might be useful for some of this to come back, as on Android I can’t really see any other way to interact with different webviews / windows other than their names

@Hassan_Radi & @jonhw : Thanks a ton. I have followed the above snippet but it didn’t worked out for me. In my application, windows has separate dynamic ID’s instead of name like below:


All are dynamic in nature.
I’m using java client 1.6.1 Is there any issue due to this??? How to resolve it??

This is totally not an Appium related question :smile:.

Most window handles have dynamic names by nature, here is something to help you always select the most recent window displayed:

Object windowHandles = driver.getWindowHandles().toArray();
driver.switchTo().window(windowHandles[windowHandles.length - 1].toString());

1 Like

@jonhw @Hassan_Radi Hi all, it is clear how select webview but how select page in webview?

In chrome://inspect I see two pages for my webview and I need second but first is used in appium.

Use Selenium’s window function normally, like this:


1 Like

Thanks, it works.:grin: