Android 如何在python中使用appium按坐标点击
我在python中使用appium尝试按坐标点击时遇到此错误: AttributeError:“列表”对象没有属性“id” 这是我使用的代码:Android 如何在python中使用appium按坐标点击,android,python-2.7,coordinates,appium,Android,Python 2.7,Coordinates,Appium,我在python中使用appium尝试按坐标点击时遇到此错误: AttributeError:“列表”对象没有属性“id” 这是我使用的代码: from selenium import webdriver from appium.webdriver.common.touch_action import TouchAction caps = {} caps["deviceName"] = "NVWCE6YSV47TGM8S" caps["platformName"] = "Android" ca
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()
希望它能帮助你,让它工作起来改变
from selenium import webdriver
到
你有一个很好的计划。我不知道人们为什么要关闭此操作。请尝试
触摸操作(驱动程序)。点击(x=104,y=255)。执行()tap
需要两个关键字而不是一个列表。@Maximilian我更改了参数。点击(x=104,y=255)
而不是。点击([(104,255)])
我得到了:keyrerror:“touchAction”。
from appium import webdriver