/Cathay-United-Bank-Appium-Homework

Using 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.

Primary LanguagePythonMIT LicenseMIT

Cathay United Bank Appium Homework

GitHub GitHub stars GitHub repo size

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.

Preparation

  1. Let Android phone and computer connect to the same Wi-Fi
  2. Enable「USB Debugging」and「Wireless Debugging」on Android phone
  3. 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.

Flow Chart

  • 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)

Learn More

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

License:MIT

This package is MIT licensed.