Lui*_*ote 4 android coordinates python-2.7 appium
尝试在python中使用appium按坐标点击时出现此错误:
AttributeError: 'list' 对象没有属性 'id'
这是我使用的代码:
from selenium import webdriver
from appium.webdriver.common.touch_action import TouchAction
caps = {}
caps["deviceName"] = "NVWCE6YSV47TGM8S"
caps["platformName"] = "Android"
caps["appPackage"] = "com.gradrix.quicklaunch"
caps["appActivity"] = "com.gradrix.quicklaunch.MainActivity"
driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
time.sleep(5)
TouchAction(driver).tap([(104, 255)]).perform()
driver.quit()
Run Code Online (Sandbox Code Playgroud)
它对我来说是这样的:
# None - don't know why is needed but as I want to tap at coordinates and not an element, is None
# 104 - X coordinate
# 255 - Y coordinate
# 1 - this is the time of the tap action
TouchAction(driver).tap(None, 104, 255, 1).perform()
Run Code Online (Sandbox Code Playgroud)
希望它有帮助,你让它工作
| 归档时间: |
|
| 查看次数: |
8567 次 |
| 最近记录: |