Mobile Device Automation error - could not access the provided web context

when i use Mobile Device Automation, get a error “could not access the provided web context”, how i can do that?
thanks

Hi @666666

I made your topic public so that our entire community can help you out.

I will also tag @Christian_Mayer who might be able to help you directly.

Hi @666666!
We would need more details:
What configuration are you using? Local device or a device in the cloud?
If it is local, how did you start the Appium server, and so on.

Usually this is related of Appium not being started with the relevant Chrome Driver that is used for Web-Automation, but I need more details to make sure that is the case.

Thanks,
Bye,
Chris

Hi @Christian_Mayer,

I am getting the same error as well when trying to interact on a certain website using mobile browser. I am using my local mobile device connected to my computer.

Based from your last comment, how can we know if the Appium started with relevant Chrome Driver? Where we can find the Chrome Driver?

Thanks!

Same error any solution …???

Im also looking into the same. Is there any solution.

In order for web automation to work, webview debugging must be enabled and the chromedriver appium is using must be compatible with the webview version installed on device.

Android

There are two use cases: 1) web applications automation (websites that start in browser) 2) applications that embed webviews. It’s a good idea to test the configuration using a simple site and see if this is working. If it’s working it means that chromedriver matches the version of chrome the browser is using and in most cases (not all however) it should match the version of webview chrome as well. If this is working but on an application is not, then the application doesn’t enable debugging webviews. For this, please see Get started with remote debugging Android WebViews or Remote debugging WebViews.

When the chromedriver doesn’t match, this is signaled in the requests, however, until version 21.10.0 of the UiPath.MobileAutomation.Activities this wasn’t easy to see in the MDM log. Now it should appear in red (see below picture)

error_reporting

If you determine that the chromedriver Appium is using, doesn’t match the one installed on device, you can start Appium with a specific chromedriver. You can download all the versions of chromedriver from ChromeDriver download page. After you got the right driver you have to tell Appium to use it:

appium --chromedriver-executable /path/to/my/chromedriver

Appium also has a feature to auto-download the right chromedriver, so you can try this as well.

appium --allow-insecure chromedriver_autodownload

Different versions of Chrome for WebView and Browser

I was saying earlier that most of the times there is only one version of Chrome in use on the device, but there are instances when there are two: the browser uses a version of chrome and the webview is using a completely different one. In this case you might want to match the two, because if you have an app that embeds webviews but also at some point escapes in the browser for let’s say two-factor authentication, the automation will work on the app if the chromedriver is matching, but it will not work in the browser where it is not, or vice versa depending on the case.

You can achieve this in two ways: 1) you upgrade/downgrade the version of Chrome or 2) you upgrade/downgrade the version of Chrome used by WebViews. The second option is more unknown so you can find more information about this at Try out WebView Beta, Dev, or Canary.

iOS

For iOS devices the story is mostly similar. First, you must ensure that the device has Web Inspector feature turned on (see more at Use Web Inspector to Debug Mobile Safari). The gist of it is the following:

Follow these quick tips to get web inspector working so you can debug your site or app for Safari

  • Reset your location and privacy settings on your iPhone, iPad, or iPod touch. Go to Settings > General > Reset > Reset Location & Privacy
  • Make sure you sign into the same Apple ID on the computer as your iPhone, iPad, or iPod touch
  • Turn Safari iCloud syncing on for both the computer and any iPhone, iPad, or iPod touch
  • On the iPhone or iPad, go to Settings > Safari > Advanced and toggle on Web Inspector
  • On the computer, open Safari and go to the Safari menu > Preferences > Advanced and checkmark Show Develop menu in menu bar

In order to tell if Web Inspector isn’t turned on you either try a simple web app, that should fail to start because it will want to use a webview context that it can’t find or check the MDM log requests tab, for Contexts call. If in the Contexts call, only NATIVE is received, then most probably Web Inspector isn’t turned on.

Links