VNC client for Pytest
Project description
pytest-vnc implements a VNC client in pure Python. It works on Mac, Linux and Windows. Use the vnc fixture to capture screenshots and send keyboard & mouse from your pytest tests:
def test_thing(vnc):
# Screenshot
print(vnc.width, vnc.height)
pixels = vnc.capture() # rgba numpy array of entire screen
pixels = vnc.capture(x=100, y=0, width=50, height=75)
# to use PIL/pillow:
# image = Image.fromarray(pixels)
# Keyboard input
vnc.write('hi there!') # keys are queued
vnc.press('Ctrl', 'c') # keys are stacked
with client.keyboard.hold('Ctrl'):
vnc.press('Esc')
# Mouse input
vnc.move(100, 200)
vnc.click()
vnc.double_click()
vnc.middle_click()
vnc.right_click()
vnc.scroll_up()
vnc.scroll_down(repeat=10)
with vnc.drag():
vnc.move(300, 400)
with vnc.middle_drag():
vnc.move(500, 600)
with vnc.right_drag():
vnc.move(700, 800)
Installation
This package requires Python 3.7+.
Install pytest-vnc by running:
pip install pytest-vnc
Configuration
The following configuration options can be set in pytest.ini:
- vnc_host
VNC hostname (default: localhost)
- vnc_port
VNC port (default: 5900)
- vnc_speed
VNC interactions per second (default: 20)
- vnc_timeout
VNC connection timeout in seconds (default: 5)
- vnc_user
VNC username (default: env var: PYTEST_VNC_USER or current user)
- vnc_passwd
VNC password (default: env var: PYTEST_VNC_PASSWD)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
pytest_vnc-1.0.0-py3-none-any.whl
(17.7 kB
view hashes)
Close
Hashes for pytest_vnc-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe842cefbf3a74cfd8888e3eb43580079ff070ae72f3015ec459fbdc50d7ab7e |
|
MD5 | 5c8d94af882248423524467ce782d8d9 |
|
BLAKE2b-256 | 7450318ee737283892790ae6a63b206569056564cc02407ec55734f8c41dfd9e |