Created
November 20, 2018 22:04
-
-
Save bbchriscesar/8e2efa2b1b9d45277552ab311a30e079 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from uiautomator import device as d | |
from adb_android import adb_android | |
import time | |
import os.path | |
# Locales | |
locales = ['en', 'ja', 'de'] | |
pathslash = '/' | |
def switchLocal(): | |
adb_android.shell( | |
'am broadcast -a com.google.android.testing.i18n.localeswitcher.CHANGE_LOCALE -e LANGUAGE_TAG ' + locale) | |
def switchToEn(): | |
adb_android.shell('am broadcast -a com.google.android.testing.i18n.localeswitcher.CHANGE_LOCALE -e LANGUAGE_TAG en') | |
time.sleep(1) | |
def startApp(): | |
adb_android.shell('monkey -p com.google.android.dialer -c android.intent.category.LAUNCHER 1') | |
def stopApp(): | |
adb_android.shell('am force-stop com.google.android.dialer') | |
def clearAppData(): | |
adb_android.shell('pm clear com.google.android.dialer') | |
def takeSS(): | |
adb_android.shell('screencap -p /sdcard/' + locale) | |
for locale in locales: | |
path = '/usr/local/google/home/christiannec/PythonAndroid/' + locale | |
if not os.path.exists(path): | |
os.makedirs(path) | |
switchLocal() | |
startApp() | |
time.sleep(2) | |
d.click(178, 1699) | |
time.sleep(2) | |
d.click(998, 147) | |
d.screenshot(path + pathslash + 'Dialer.png') | |
time.sleep(1) | |
stopApp() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment