您好,欢迎来到二三四教育网。
搜索
您的当前位置:首页appium使用find_element_by_xxx方式成功2

appium使用find_element_by_xxx方式成功2

来源:二三四教育网

# This sample code uses the Appium python client

# pip install Appium-Python-Client

# Then you can paste this into a file and simply run with Python

from appiumimport webdriver

import time

caps = {}

caps["app"] ="D:\\MyApplication\\app\\release\\app-release.apk"

caps["platformName"] ="Android"

# caps["deviceName"] = "UYT0217A21002556"

caps["deviceName"] ="2948d102"

caps["appPackage"] ="com.example.administrator.myapplication"

caps["appActivity"] =".SettingsActivity"

#下方代码有错误,原因未知,后续再找

# general = driver.find_element_by_name("General")

general = driver.find_element_by_android_uiautomator('new UiSelector().text("General")');

general.click()

time.sleep(60)

#

# TouchAction(driver).tap(x=234, y=318).perform()

# time.sleep(1)

# TouchAction(driver).tap(x=967, y=377).perform()

# time.sleep(1)

# TouchAction(driver).tap(x=100, y=172).perform()

# time.sleep(1)

# TouchAction(driver).tap(x=264, y=469).perform()

# time.sleep(1)

# TouchAction(driver).tap(x=959, y=314).perform()

# time.sleep(1)

# TouchAction(driver).tap(x=967, y=707).perform()

# time.sleep(1)

# TouchAction(driver).tap(x=946, y=318).perform()

# time.sleep(1)

# TouchAction(driver).tap(x=75, y=180).perform()

# time.sleep(5)

driver.quit()

Copyright © 2019- how234.cn 版权所有 赣ICP备2023008801号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务