from appium import webdriver
import time
def getSize():
x=driver.get_window_size()['width']
y=driver.get_window_size()['height']
print(x,y)
return (x,y)
def swipeup(t):
print("正在向上滑动..")
screensize=getSize()
x1=int(screensize[0]*0.5)#x坐标
y1=int(screensize[1]*0.75)#起始y坐标
y2=int(screensize[1]*0.25)#终点y坐标
driver.swipe(x1,y1,x1,y2,t)
print(x1, y1, y2)
caps = {}
caps["platformName"]= "Android"
caps["deviceName"]="FDU19510027327"
caps["platformVersion"]= "10"
caps["noReset"] = True
caps["appPackage"] = "com.taobao.taobao"
caps["appActivity"]= "com.taobao.tao.welcome.Welcome"
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub',caps)
time.sleep(5)
swipeup(1000)
driver.quit()
报错是这样
C:\Users\24237\AppData\Local\Programs\Python\Python37\python.exe C:/Users/24237/PycharmProjects/untitled1/1/__init__.py
正在向上滑动..
1080 2208
Traceback (most recent call last):
File "C:/Users/24237/PycharmProjects/untitled1/1/__init__.py", line 25, in <module>
swipeup(1000)
File "C:/Users/24237/PycharmProjects/untitled1/1/__init__.py", line 14, in swipeup
driver.swipe(x1,y1,x1,y2,t)
File "C:\Users\24237\AppData\Roaming\Python\Python37\site-packages\appium\webdriver\extensions\action_helpers.py", line 164, in swipe
actions.perform()
File "C:\Users\24237\AppData\Roaming\Python\Python37\site-packages\selenium\webdriver\common\action_chains.py", line 75, in perform
self.w3c_actions.perform()
File "C:\Users\24237\AppData\Roaming\Python\Python37\site-packages\selenium\webdriver\common\actions\action_builder.py", line 77, in perform
self.driver.execute(Command.W3C_ACTIONS, enc)
File "C:\Users\24237\AppData\Roaming\Python\Python37\site-packages\selenium\webdriver\remote\webdriver.py", line 418, in execute
self.error_handler.check_response(response)
File "C:\Users\24237\AppData\Roaming\Python\Python37\site-packages\appium\webdriver\errorhandler.py", line 31, in check_response
raise wde
File "C:\Users\24237\AppData\Roaming\Python\Python37\site-packages\appium\webdriver\errorhandler.py", line 26, in check_response
super().check_response(response)
File "C:\Users\24237\AppData\Roaming\Python\Python37\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Method has not yet been implemented
Stacktrace:
NotYetImplementedError: Method has not yet been implemented
at AndroidDriver.executeCommand (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\basedriver\driver.js:266:13)
at AppiumDriver.executeCommand (C:\Program Files\Appium\resources\app\node_modules\appium\lib\appium.js:485:36)
at process._tickCallback (internal/process/next_tick.js:68:7)
Process finished with exit code 1