#coding =utf-8
From Appium import Webdriver
From time import sleep
Import OS
From selenium.webdriver.common.by Import by
PATH = Lambda P:os.path.abspath (
Os.path.join (Os.path.dirname (__file__), p)
)
Desired_caps = {
' PlatformName ': ' Android ',
' Platformversion ': ' 4.4.2 ',
' DeviceName ': ' Y15QKCNQ237LC ',
# desired_caps[' app ' =path (' c:\\users\\administrator\\desktop\\shoujitaobao_151.apk ')
#如果手机未安装该软件, and the installation package is on the computer, you need to specify the path, the package name and the activity name do not specify
#如果手机已经安装, you do not need to specify a path, specify the following package name and activity name to
' Apppackage ': ' Com.taobao.taobao ',
' appactivity ': ' Com.taobao.tao.welcome.Welcome ',
#屏蔽软键盘, easy to enter Chinese
' Unicodekeyboard ': True,
' Resetkeyboard ': True
}
#启动app
Driver = Webdriver. Remote (' Http://localhost:4723/wd/hub ', desired_caps)
Sleep (5)
y = driver.get_window_size () [' Height ']
Print Y
#屏幕上滑
Driver.swipe (0, int (y) * 0.75, 0, int (y) * 0.25)
#屏幕下滑
Driver.swipe (0, int (y) * 0.25, 0, int (y) * 0.75)
Mobile screen swipe up and down