qq_36324646
梦寒丶
2017-10-27 02:57

appium 使用swipe时报错WebDriverException: Message

1
  • python
  • 自动化测试
  • appium
  • swipe
  • android

-*- codeing: utf-8 -*-

from appium import webdriver
import time
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.4'
desired_caps['deviceName'] = '1a07c04e'
desired_caps['appPackage'] = 'com.cloudhome'
desired_caps['unicodeKeyboard'] = 'True'
desired_caps['resetKeyboard'] = 'True'
desired_caps['automationName'] = 'link text'
desired_caps['appActivity'] = 'ui.common.WelcomeActivity'
desired_caps['chromeOptions'] = {'androidProcess': 'com.tencent.mm:tools'} # 驱动H5自动化关键之一
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps);

获取屏幕宽高

height = driver.get_window_size()["height"];
width = driver.get_window_size()["width"];
time.sleep(4)
x = width - 50
y = height / 2
x2 = 50
y2 = height / 2
duration = 3
driver.swipe(x,y ,x2 ,y2,duration)

#  魅族可以运行 小米报错

图片说明

图片说明

图片说明

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答