|
本帖最后由 wxmwindy1980 于 2017-4-26 15:12 编辑
很简单的一段代码,目的就是打开手机上的今日头条,执行手势滑动,但是一直报错(错误在swipe那句,今日头条可以正常打开),找不到原因,网上查了半天也没有类似的错误。求救各位同行,不胜感激!
环境
appium 1.4.16
java "1.8.0_31"
python 3.5.3
代码
#-*-coding:utf8-*-
from appium import webdriver
from time import sleep
device='612QFCPR225ZS'
pack='com.ss.android.article.news'
activity='com.ss.android.article.news.activity.SplashActivity'
PATH = lambda p: os.path.abspath(
os.path.join(os.path.dirname(__file__), p)
)
desired_caps={}
desired_caps['device'] = 'android'
desired_caps['platformName']='Android'
desired_caps['browserName']=''
desired_caps['Version']='6.0.1'
desired_caps['deviceName']=device
#desired_caps['app']=PATH('D:\\jr.apk')
desired_caps['appPackage'] = pack
desired_caps['appActivity'] = activity
driver=webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
'''while 1:
if driver.current_activity=='.activity.MainActivity':
print ("1")
break
'''
driver.swipe(1035,835,1035,586,1000)
driver.quit()
错误:
Traceback (most recent call last):
File "E:\学习\appium\test1.py", line 29, in <module>
driver.swipe(1035,835,1035,586,1000)
File "D:\Python\Python35\lib\site-packages\appium\webdriver\webdriver.py", line 264, in swipe
action.perform()
File "D:\Python\Python35\lib\site-packages\appium\webdriver\common\touch_action.py", line 94, in perform
self._driver.execute(Command.TOUCH_ACTION, params)
File "D:\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "D:\Python\Python35\lib\site-packages\appium\webdriver\errorhandler.py", line 29, in check_response
raise wde
File "D:\Python\Python35\lib\site-packages\appium\webdriver\errorhandler.py", line 24, in check_response
super(MobileErrorHandler, self).check_response(response)
File "D:\Python\Python35\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command.
|
|