Perform a click operation at specified coordinates or current position.
Parameter
Type
Required
Default
Description
x
integer | null
No
null
X coordinate to click at
y
integer | null
No
null
Y coordinate to click at
button
enum
No
"left"
Mouse button to use ("left", "right", "middle")
clicks
integer
No
1
Number of clicks (range: 1-10)
interval
number | null
No
0
Time between clicks in seconds (range: 0-1)
# Simple left click at coordinatesskylight.interact.click(instance_id="instance123", x=300, y=400)# Right clickskylight.interact.click(instance_id="instance123", x=300, y=400, button="right")# Middle clickskylight.interact.click(instance_id="instance123", button="middle")# Double clickskylight.interact.click(instance_id="instance123", x=300, y=400, clicks=2)# Click at current position (no x,y specified)skylight.interact.click(instance_id="instance123")# Click with 0.5 second interval between clicksskylight.interact.click(instance_id="instance123", x=300, y=400, clicks=2, interval=0.5)
Perform a drag operation along a path of coordinates.
Parameter
Type
Required
Default
Description
path
object[]
Yes
-
List of points to drag through, each with x and y coordinates
button
enum
No
"left"
Mouse button to use ("left", "right", "middle")
step
integer | null
No
null
Step size for drag movements (range: 1-100)
# Drag from one point to anotherskylight.interact.drag(instance_id="instance123", path=[{"x":100,"y":200},{"x":300,"y":400}])# Specify step size for more granular movementskylight.interact.drag(instance_id="instance123", path=[{"x":100,"y":200},{"x":300,"y":400}], step=10)# Use a different mouse buttonskylight.interact.drag(instance_id="instance123", path=[{"x":100,"y":200},{"x":300,"y":400}], button="right")
# Press Enter keyskylight.interact.keypress(instance_id="instance123", keys=["Enter"])# Press Ctrl+Cskylight.interact.keypress(instance_id="instance123", keys=["ctrl","c"])# Press Ctrl+Alt+Deleteskylight.interact.keypress(instance_id="instance123", keys=["ctrl","alt","delete"])# Take a screenshot with Windows+Shift+Sskylight.interact.keypress(instance_id="instance123", keys=["super","shift","s"])
Type the specified text with optional delay between keystrokes.
Parameter
Type
Required
Default
Description
text
string
Yes
-
Text to type
interval
number | null
No
0.05
Time between keystrokes in seconds (range: 0.01-0.5)
# Type text with default interval between keystrokesskylight.interact.type(instance_id="instance123", text="Hello World")# Type with custom interval between keystrokes (in seconds)skylight.interact.type(instance_id="instance123", text="Hello World", interval=0.1)
# Get a file from the VMdownload_url = skylight.interact.get_file(instance_id="instance123", request_body={"key":"/path/to/file.txt"})# Returns a presigned URL to download the file
# Move mouse to Start button and clickskylight.interact.click(instance_id="instance123", x=20, y=980)# Type the application nameskylight.interact.type(instance_id="instance123", text="notepad")# Press Enter to launchskylight.interact.keypress(instance_id="instance123", keys=["Enter"])
# Select a file by clicking on itskylight.interact.click(instance_id="instance123", x=200, y=300)# Drag the file to a new locationskylight.interact.drag(instance_id="instance123", path=[{"x":200,"y":300},# Starting position (file location){"x":500,"y":400}# Ending position (destination)])
# Click to position cursorskylight.interact.click(instance_id="instance123", x=300, y=400)# Type some textskylight.interact.type(instance_id="instance123", text="This is some sample text.")# Select all text (Ctrl+A)skylight.interact.keypress(instance_id="instance123", keys=["ctrl","a"])# Copy text (Ctrl+C)skylight.interact.keypress(instance_id="instance123", keys=["ctrl","c"])# Click somewhere elseskylight.interact.click(instance_id="instance123", x=300, y=500)# Paste text (Ctrl+V)skylight.interact.keypress(instance_id="instance123", keys=["ctrl","v"])
# Take a screenshotscreenshot = skylight.interact.screenshot(instance_id="instance123")# Save the screenshot locally (assuming base64 encoding)import base64withopen("screenshot.png","wb")as f: f.write(base64.b64decode(screenshot))# Get a file from the VMdownload_url = skylight.interact.get_file(instance_id="instance123", request_body={"key":"C:/Users/Administrator/Documents/example.txt"})# Download the file using the URLimport requestsresponse = requests.get(download_url)withopen("example.txt","wb")as f: f.write(response.content)