# 代码如下:
from appium import webdriver
from time import sleep

desired_caps={}
desired_caps['platformName'] = 'Android'

# 模拟器设备
desired_caps['platformVersion'] = '7.1.2'
desired_caps['deviceName'] = '127.0.0.1:62026'

desired_caps['app'] = r'C:\Users\Andysong\Desktop\kaoyan3.1.0.apk'
desired_caps['appPackage'] = 'com.tal.kaoyan'
desired_caps['appActivity'] = 'com.tal.kaoyan.ui.activity.SplashActivity'

driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
driver.implicitly_wait(5)
sleep(3)

driver.find_element_by_id('android:id/button2').click()
sleep(5)

driver.find_element_by_id('com.tal.kaoyan:id/tv_skip').click()
# driver.find_element_by_xpath('//android.widget.TextView[@text="跳过 > "]').click()
# driver.find_element_by_xpath('//*[@class="android.widget.TextView" and @index="2"]').click()
# driver.find_element_by_android_uiautomator\
#     ('new UiSelector().resourceId("com.tal.kaoyan:id/tv_skip")').click()

本人遇到的问题截图







↙↙↙阅读原文可查看相关链接,并与作者交流