appium : 手机操作整理
程序员文章站
2022-07-12 22:19:55
...
获取手机时间 .device_time
获取手机宽高,分辨率 .get_window_size() .get_window_size()["width"] .get_window_size()["height"]
w = driver.get_window_size()["width"]
h = driver.get_window_size()["height"]
a = w*0.5 #开始的x坐标点,屏幕宽*0.5
c = a #结束的x坐标点
d = w * 0.25 #结束的y坐标点
b = d *3 #开始的y坐标点
#手机滑动
driver.swipe(a,b,c,d,5000)
#获取手机的时间
#driver.device_time
print(driver.device_time)
#获取手机的分辨率
print(driver.get_window_size())
print(driver.get_window_size()["width"])
print(driver.get_window_size()["height"])
运行结果:
整理: