梦寒丶
2017-10-27 02:57appium 使用swipe时报错WebDriverException: Message
1-*- 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条回答
为你推荐
- Appium到底怎么定位父兄元素?
- xpath
- appium
- 1个回答
- 在 Python 中查找给定包含该项的列表的项索引
- python
- list
- 0个回答
- appium测试Android APP,启动后app后 自定义显示等待 登录页面加载完成,总是报错
- appium
- java
- 显示等待
- 自动化测试
- po设计模式
- 1个回答
- TypeError: 'NoneType' object is not subscriptable
- python
- numpy
- typeerror
- 1个回答
- android-appium: A new session could not be created
- appium
- junit
- android
- exception
- 自动化
- 1个回答