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

简单的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日

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测