airtest.core.linux.linux module

class Linux(pid=None, **kwargs)[源代码]

基类:airtest.core.device.Device

Linux desktop.

shell(cmd)[源代码]

Run shell command in subprocess

参数:cmd – command to be run
Raises:subprocess.CalledProcessError – when command returns non-zero exit status
返回:command output as a byte string
snapshot(filename='tmp.png', quality=None)[源代码]

Take a screenshot and save it to tmp.png filename by default

参数:
  • filename – name of file where to store the screenshot
  • quality – ignored
返回:

display the screenshot

keyevent(keyname, **kwargs)[源代码]

Perform a key event

References

https://pywinauto.readthedocs.io/en/latest/code/pywinauto.keyboard.html

参数:
  • keyname – key event
  • **kwargs – optional arguments
返回:

None

text(text, **kwargs)[源代码]

Input text

参数:
  • text – text to input
  • **kwargs – optional arguments
返回:

None

touch(pos, **kwargs)[源代码]

Perform mouse click action

References

https://pywinauto.readthedocs.io/en/latest/code/pywinauto.mouse.html

参数:
  • pos – coordinates where to click
  • **kwargs – optional arguments
返回:

None

double_click(pos)[源代码]
swipe(p1, p2, duration=0.8, steps=5)[源代码]

Perform swipe (mouse press and mouse release) :param p1: start point :param p2: end point :param duration: time interval to perform the swipe action :param steps: size of the swipe step

返回:None
start_app(path)[源代码]

Start the application

参数:path – full path to the application
返回:None
stop_app(pid)[源代码]

Stop the application

参数:pid – process ID of the application to be stopped
返回:None
get_current_resolution()[源代码]
get_ip_address()[源代码]

Return default external ip address of the linux os.

返回:ip address
返回类型:str