我在尝试使用 python 中的 appium 按坐标点击时遇到此错误:
AttributeError: 'list' object has no attribute '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()
最佳答案
它对我来说是这样的:
# 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()
希望对你有帮助,希望你能成功
关于android - 如何在python中使用appium按坐标点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47164297/