Uing Appium to remote control Android mobile phone(Pixel 3a)to test some credit card views are appear correctly on Cathay United Bank website with Chrome.
- Let Android phone and computer connect to the same Wi-Fi
- Enable「USB Debugging」and「Wireless Debugging」on Android phone
- Connect to Android phone by commands below in terminal:
adb connect replace_with_Android_phone's_IP
adb tcpip 5555
If it run for a long time and no result, use killall adb
command and try again.
- Set up web driver with these capabilities:
desiredCapabilities = {
'platformName': 'Android',
'platformVersion': '12',
'deviceName': 'replace_with_Android_phone's_IP:5555',
'automationName': 'UiAutomator2',
'browserName': 'Chrome', # use native broswer app
'noReset': True, # don't reset sttings in Chrome app
'newCommandTimeout': 60 # if our code do nothing for 60 seconds, the connection will quit
}
- Using
try except
, so that if connect is weak and timeout we could use the code below to rerun main.py
os.execv(sys.executable, ['python3'] + sys.argv)
Use these command line in terminal
- To see all activities of an app when using it.(sometimes main activity isn't the launch activity of an app)
adb logcat | grep START
- To see the current running activity
adb shell dumpsys activity | grep mCurrentFocus
This package is MIT licensed.