1、get_window_size (windowHandle='current'):获取当前设备的宽、高。
用法:width = driver.get_window_size()['width']
height = driver.get_window_size()['height']
2、location:获取元素的左上角坐标。
用法:x = element.location['x']
y = element.location['y']
3、size:获取元素的宽、高。
用法:width = element.size['width']
height = element.size['height']
4、current_activity:获取设备当前的activity值,只适用于Android。
用法:driver.current_activity
5、rect:获取元素的尺寸和坐标。
用法:x = element.rect['x']
y = element.rect['y']
width = element.rect['width']
height = element.rect['height']
官方链接:http://appium.io/docs/en/commands/web/window/get-window-size/
http://appium.io/docs/en/commands/element/attributes/location/
网友评论