Mobile app automation
Android + Chrome + Python
To be able to run tests Chrome broser should be pre-installed on Android device,
Python + Chrome + Android
To be able to work with web-application on Android device using Selenium below pre-conditions should be met:
Android SDKinstalled on computerChromebrowser installed onAndroiddevice- Debugging mode enabled on
Androiddevice
Start adb and chromedriver server with below commands from cmd/Terminal:
adb start-server
chromedriverNote down chromedriver server port number from log that looks like
Starting ChromeDriver 2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3) on port 9515
Connect Android device to computer with USB cable
Below is simple Python code to get Google page:
from selenium import webdriver
capabilities = {
'chromeOptions': {
'androidPackage': 'com.android.chrome',
}
}
driver = webdriver.Remote('https://localhost:9515', capabilities) # Specify your port number value
driver.get('https://google.com')
driver.quit()