# 我的脚本:
#-*- coding: UTF-8 -*-
import os
import time
import unittest
from selenium import webdriver
from lib2to3.pgen2.driver import Driver
from lib2to3.tests.support import driver
PATH=lambda p:os.path.abspath(os.path.join(os.path.dirname(__file__),p))
global driver
class LoginAndroidTests(unittest.TestCase):
def setUp(self):
desired_caps={}
desired_caps['device'] = 'android'
desired_caps['platformName']='Android'
desired_caps['browserName']=''
desired_caps['version']='4.4.2'
desired_caps['deviceName']='HUAWEI H60-L01'
desired_caps['appPackage']='com.vehicles.activities'
desired_caps['appActivity']='.activity.Init.InitActivity'
self.driver=webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
def tearDown(self):
self.driver.quit()
def test_login(self):
print"开始执行脚本"
time.sleep(20)
self.driver.swipe(460,193,460,924,1000)
print "下拉刷新成功"
if __name__ == '__main__':
unittest.main()
省略了登录部分的脚本,因为想快速定位 self.driver.swipe() 的问题。
查过 api 文档了,觉得没有写错,也谷歌过报错了,没有找到解决方案,请指点我一下,非常感谢!