app 入口获取
- 通过logcat 获取
adb logcat ActivityManager:I |findstr "cmp" 启动应用即可
- 通过aapt获取
appt dump badging wework.apk |findstr launchable-activity
- 启动应用
adb shell am start -W -n package-name/activityname -S
from appium import webdriver
# 获取 安装包和启动页名:adb logcat ActivityManager:I|findstr "cmp"
class TestWX:
def setup(self):
desire_cap = {
"platformName": "Android",
"deviceName": "882QADTN22V59",
"appPackage": "com.tencent.wework",
"appActivity": ".launch.LaunchSplashGovActivity",
"settings[waitForIdleTimeout]":1,
'noReset': True,
'dontStopAppOnReset': True, # 首次启动的时候不停止APP
'skipDeviceInitialization': True # 跳过安装、权限设置操作
}
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desire_cap)
self.driver.implicitly_wait(15)
def teardown(self):
self.driver.quit()
def test_daka(self):
self.driver.find_element_by_xpath("//*[@text='工作台']").click()
self.driver.find_element_by_android_uiautomator(
'new UiScrollable(new UiSelector().scrollable(true).instance(0)).'
'scrollIntoView(new UiSelector().text("打卡").instance(0));').click()
self.driver.find_element_by_xpath("//*[@text='外出打卡']").click()
self.driver.find_element_by_xpath("//*[contains(@text, '次外出')]").click()
self.driver.find_element_by_xpath("//*[@text='外出打卡成功']")