Add coordinate click and file upload actions#3115
Open
jinxjinxagain wants to merge 4 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two browser interaction capabilities to the HTTP API:
POST /tabs/:tabId/clickPOST /tabs/:tabId/uploadendpointDetails
Coordinate click
POST /tabs/:tabId/clicknow accepts acoordinatesobject in addition to the existingrefandselectorinputs:{ "userId": "user-1", "coordinates": { "x": 320, "y": 240 } }The server validates the coordinate values and dispatches a mouse move/down/up sequence at the requested point. Existing
refandselectorclick behavior is preserved.File upload
Adds
POST /tabs/:tabId/uploadfor setting local files on a file input or triggering a file chooser. The endpoint supports:filePathfor a single local filefilesfor multiple local filesref,selector, orcoordinatesto target the file input / upload controlExample:
{ "userId": "user-1", "filePath": "/tmp/avatar.png", "selector": "input[type=file]" }If the target element is an
input[type=file], the endpoint usessetInputFiles. Otherwise it waits for a file chooser after clicking the target and then sets the selected files.API docs
The new upload endpoint is documented in the generated OpenAPI spec.
Validation
npm test -- --runTestsByPath tests/unit/openapi.test.js