DDD_Dawn 2021-11-18 21:54 采纳率: 100%
浏览 134
已结题

简单的appium控制滑动,不懂,求解答


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


  • 写回答

3条回答 默认 最新

  • CSDN专家-黄老师 2021-11-19 15:14
    关注

    你的代码在我这边是能跑通的,如图,,你那边报错是否Appium环境问题,我的环境如下

    img

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 11月28日
  • 已采纳回答 11月20日
  • 创建了问题 11月18日

悬赏问题

  • ¥50 MATLAB APP 制作出现问题
  • ¥15 wannier复现图像时berry曲率极值点与高对称点严重偏移
  • ¥15 利用决策森林为什么会出现这样·的问题(关键词-情感分析)
  • ¥15 DispatcherServlet.noHandlerFound No mapping found for HTTP request with URI[/untitled30_war_e
  • ¥15 使用deepspeed训练,发现想要训练的参数没有梯度
  • ¥15 寻找一块做为智能割草机的驱动板(标签-stm32|关键词-m3)
  • ¥15 信息管理系统的查找和排序
  • ¥15 基于STM32,电机驱动模块为L298N,四路运放电磁传感器,三轮智能小车电磁组电磁循迹(两个电机,一个万向轮),怎么用读取的电磁传感器信号表示小车所在的位置
  • ¥15 如何解决y_true和y_predict数据类型不匹配的问题(相关搜索:机器学习)
  • ¥15 PB中矩阵文本型数据的总计问题。