import time
from appium import webdriver
import pytest
import datetime
class Testfangdongliqi:
u'测试应付账'
def setup_class(self):
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.4.2'
desired_caps['deviceName'] = '022GPLDU3A010372'
desired_caps['appPackage'] = 'prancent.project.rentalhouse.app'
desired_caps['appActivity'] = '.activity.WelComeActivity'
desired_caps['unicodeKeyboard']=True
desired_caps['resetKeyboard']=True
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
time.sleep(1)
def teardown_class(self):
self.driver.quit()
def getSize(self): #获取屏幕尺寸
x=self.driver.get_window_size()['width']
y=self.driver.get_window_size()['height']
return (x,y)
def swipeDown(self):
phone_size=self.getSize()
x1=int(phone_size[0]*0.5)
y1=int(phone_size[1]*0.35)
y2=int(phone_size[1]*0.85)
self.driver.swipe(x1,y1,x1,y2)#向下滑动
获取手机屏幕尺寸
最新推荐文章于 2024-05-23 14:33:23 发布