1

I know it is possible to open a desktop web browser with Selenium WeDriver. The following lines written in Java allows doing so:

WebDriver webDriverChrome = new ChromeDriver();
webDriverChrome.get(pagesToTest[i]);

At the same time we can debug web application on mobile browsers using inspect screen while mobile devices are connected via USB:

enter image description here

enter image description here

The question is:

Is it possible to automate the inspection of web pages via mobile browsers using real devices with Selenium WebDriver?

9
  • could you add more infromation on how you are debuggin mobile browser , please add the configuration infromationn
    – PDHide
    Feb 25, 2021 at 17:26
  • What configuration do you require? Browser versions and devices?
    – Seeker001
    Feb 26, 2021 at 11:20
  • how are you debugging mobile browser in desktop
    – PDHide
    Feb 26, 2021 at 11:26
  • Via the page which is displayed on the first screen. "inspect" button.
    – Seeker001
    Feb 26, 2021 at 11:55
  • 1
    @PDHide --- It is possible to inspect chrome running on a mobile phone. Try plugging an android phone into a laptop and going to this URL --- chrome://inspect/#devices
    – ToastMan
    Feb 26, 2021 at 15:11

3 Answers 3

1

Answer is yes , you dont need appium .

https://chromedriver.chromium.org/getting-started/getting-started---android

Thanks for the wonderful question

You can run chrome in android device straight from selenium:

First make sure adb version is latest:

download latest from : https://developer.android.com/studio/releases/platform-tools

the adb will be inside the platform tool

Now make sure device detected

run:

adb devices

And make sure device shows in the list

enter image description here

make sure it is showing device and not unauthorized:

Now you can run below code:

python:

you can add experimental option (for any binding )

options = webdriver.ChromeOptions()
options.add_experimental_option('androidPackage', 'com.android.chrome')
driver = webdriver.Chrome('./chromedriver', options=options)
driver.get('https://google.com')
driver.quit()

You can see how to inspect from desktop here:

https://developers.google.com/web/tools/chrome-devtools/remote-debugging#troubleshooting https://developers.google.com/web/tools/chrome-devtools/remote-debugging

0

I think the answer you are looking for is "Appium". Appium is very similar to Selenium WebDriver, except you will need to update the desired capabilities in order to work with the mobile browser.

0

Yes. It is possible to automate the inspection of web pages via mobile browsers using real devices with Selenium WebDriver. Appium can help you the most.

Appium is an open source test automation framework for use with native, hybrid and mobile web apps. NO dependency on Mobile device OS. It has framework or wrapper that translate Selenium Webdriver commands into UIAutomation (iOS) or UIAutomator (Android) commands depending on the device type, not any OS type.

Appium supports all languages that have Selenium client libraries like- Java, Objective-C, JavaScript with node.js, PHP, Ruby, Python, C#, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.