Package Torello.Browser.BrowserAPI
Class Input
- java.lang.Object
-
- Torello.Browser.BrowserAPI.Input
-
public class Input extends java.lang.Object
This class was built using the Chrome Remote Dev-Tools A.P.I., which is specified by two JSON-RPC Files. These files were obtained from the Chrome Dev Tools Protocol Git Hub Page, which has a "Tip of Tree" (the latest) API-Specification Page Here: JSON-RPC Protocol Specification.
These files were converted into this Java-Browser (CDP) Library. The intention is to have them function in a similar fasion to the Node.js Tool known as 'Puppeteer', Microsoft's 'Playwright' and of course the Main-Stay 'Selenium.' The Java-HTML JAR Library merely implements the Java Types & Commands defined by Google's DevTools Protocol.
🧠 View the Google CDP API:
[No Description Provided by Google]
The top-level description and explanation for this class (this comment, at the top this Java-Doc Page) is repeated, verbatim, across all of the domain classes which comprise Google's CDP API.This class is intended to be used with a Browser Instance
These methods have been tested, to some degree, using Google Chrome. In order to use this class you must start a web-browser instance and make a connection to the browser using aRemote Debugging Port. Google-Corporation is the developer of this API, but any browser which accepts a Remote Debug Port Connection over Web-Sockets.
Google-Chrome was used during the development process of the classes in this particular package. Lately, it has been asserted Microsoft has switched to using the Chrome Browser-Engine for its Microsoft Edge Internal Code-Base. Therefore, there may some functionality available when running the methods in this class with Microsoft-Edge.
Check whether the your Web-Browser will allow itself to be driven by theWeb-Socket RDP-Port 9223. See the examples available in packageTorello.Browserto undertand how to build aPageConnandBrowserConnWeb-Socket Connection, and how to build aWebSocketSenderinstance in order to execute the methods in this class.
Web-Socket & JSON API:
Every one of the methods that reside in this class are designed to do nothing more than:- Accept Parameters from the User, and "Marshall Them" into a Valid JSON-Request
- Transmit the Marshalled Request-JSON to a Headless Web-Browser over a Web-Socket Connection
- Receive BOTH that Command-Results AND any Browser Event-Firings from the Web-Socket
- Parse JSON Method-Results and Browser-Event Firings, and Subsequently Convert them to Standard Java-Types
- Report these Method-Results and Browser-Events to the User via a User-Registered, Event-Listener (Events) or a Promise Object (Command Responses / Results)
Unlike the bulk of the Java HTML JAR Library, there is very little native Java-Code, and very little testing that may be done on any of the classes & methods in this package. The code inside these classes does nothing more than marshall-and-unmarshall Java-Types into Json-Requests (and vice-versa). The Java-Script & Browser modules inside of a Google-Chrome instance are, theoretically, handling these requests, and returning their results (or events) over the Web-Socket Connection.
It has been asserted (by Google Chrome Developers) that some of these methods are only "partially working" or "experimental".
Asking Chat-GPT for Help:
The LLM otherwise known as "Chat-GPT" does, indeed, have an expert level of knowledge about the "Remote DevTools Protocol". The API that theChrome DevTools Protocl (CDP)exports is extremely well understood by the LLM, and generally I have found that Chat-GPT understands (by 2 or 3 orders of magnitude) better what my Auto-Generated JSON-Wrappers can do in controlling a Web-Browser than I could ever possibly hope to understand.
Though not available today, there will soon be an automatically downloadable Token-Stream (AI Embeddings) BUTTON available on my Java-Doc Pages that should hopefully make it extremely easy to post my code-base, RAG Style, to Chat-GPT and other LLM's when 'interogating' them. Presently, because my "Get Token Stream Button" does not exist yet on any of my pages, what you can do is copy-and-paste any Method-Signature from any one of these pages and then ask Chat-GPT to explain what that Browser or Java-Script Function is actually doing. It is very likely to give you some pretty neat answers.
I have found that every single one of the Domains, Types & Events which are offered by the CDP Protocol (though not documented very well by Google), are perfectly understood by the A.I. LLM - literally to the point where it does know (much better than I ever could) what my own code base actually does!
Try it out, it's a lot of fun. Note that this package and these classes were originally developed solely to be able to execute the Java-Script that a browser executes when visiting a Web-Site. Complete HTML-Page Content can be scraped (using the HTML Data-Scraping Tools in Java-HTML) off of Web-Sites that have dynamic / Java-Script Generated Content.
Conspicuous Boxed-Types Usage:
You may notice that there are many methods that have parameters which accept, for instance, anInteger, instead of a primitiveint. Just to remind the readiner, in Java Programs aBoxed Typeis a standard Java-Primitive which has been converted into an Object-Reference. The use of Boxed-Types in this code base is an easy-and-fast-way to allow for the concept of "Optional Parameters" or "Optional Field Value."
Whenever you see a method that accepts anInteger, the reason for this Parameter-Type choice is actually to allow a user to pass 'null' to it. This is a simple way to ELIDE passing any value at all to parameters which Google-Chrome would otherwise assert are "Optional." Whenever you pass 'null' to a Boxed-Types in this class, the Json-Processor will simply eliminate that Object-Property from the command altogether; and the browser will simply not receive any value for that parameter when that command is invoked.
The Java Language Specification does not have an easy or well defined means of accepting optional method parameters; so Boxed-Types and 'null' are utilized here. Note that 'null' may be passed to any Command Method-Parameter that is listed asOptionalon the Java-Doc Page description for that parameter.
Hi-Lited Source-Code:This File's Source Code:
- View Here: Torello/Browser/BrowserAPI/Input.java
- Open New Browser-Tab: Torello/Browser/BrowserAPI/Input.java
File Size: 49,679 Bytes Line Count: 1,187 '\n' Characters Found
Helper: Command Invocation Helpers
- View Here: Input$$Commands.java
- Open New Browser-Tab: Input$$Commands.java
File Size: 8,162 Bytes Line Count: 174 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctionalAnnotation may also be called 'The Spaghetti Report'.Static-Functionalclasses are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@StatelessAnnotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 21 Method(s), 21 declared static
- 3 Field(s), 3 declared static, 3 declared final
-
-
Nested Class Summary
Type Nested Classes: Types / Classes that Are Used & Exported by this Domain Modifier and Type Class Description static classInput.DragData[No Description Provided by Google]static classInput.DragDataItem[No Description Provided by Google]static classInput.TouchPoint[No Description Provided by Google]Event Nested Classes: Browser Events, as Java Inner Classes, Which are Fired by this Domain Modifier and Type Class Description static classInput.dragInterceptedEmitted only whenInput.setInterceptDragsis enabled.
-
Field Summary
Enumerated Strings: Like Java 'enum' Types, but Converted to Read-Only String-Lists Modifier and Type Field Description static ReadOnlyList<String>GestureSourceType[No Description Provided by Google]static ReadOnlyList<String>MouseButton[No Description Provided by Google]Eliminated Types: Removed CDP Types which Have Been Re-Mapped to Basic Java String Constants Modifier and Type Field Description static StringTimeSinceEpochUTC time in seconds, counted from January 1, 1970.
-
Method Summary
Input Domain Commands Script Returns Modifier and Type Method Voidstatic Script<>cancelDragging()
Cancels any active dragging in the page.Voidstatic Script<>dispatchDragEvent(String type, Number x, Number y, Input.DragData data, Integer modifiers)
Dispatches a drag event into the page.Voidstatic Script<>dispatchKeyEvent(String type, Integer modifiers, Number timestamp, String text, String unmodifiedText, String keyIdentifier, String code, String key, Integer windowsVirtualKeyCode, Integer nativeVirtualKeyCode, Boolean autoRepeat, Boolean isKeypad, Boolean isSystemKey, Integer location, String[] commands)
Dispatches a key event to the page.Voidstatic Script<>dispatchMouseEvent(String type, Number x, Number y, Integer modifiers, Number timestamp, String button, Integer buttons, Integer clickCount, Number force, Number tangentialPressure, Number tiltX, Number tiltY, Integer twist, Number deltaX, Number deltaY, String pointerType)
Dispatches a mouse event to the page.Voidstatic Script<>dispatchTouchEvent(String type, Input.TouchPoint[] touchPoints, Integer modifiers, Number timestamp)
Dispatches a touch event to the page.Voidstatic Script<>emulateTouchFromMouseEvent(String type, int x, int y, String button, Number timestamp, Number deltaX, Number deltaY, Integer modifiers, Integer clickCount)
Emulates touch event from the mouse event parameters.Voidstatic Script<>imeSetComposition(String text, int selectionStart, int selectionEnd, Integer replacementStart, Integer replacementEnd)
This method sets the current candidate text for IME.Voidstatic Script<>insertText(String text)
This method emulates inserting text that doesn't come from a key press, for example an emoji keyboard or an IME.Voidstatic Script<>setIgnoreInputEvents(boolean ignore)
Ignores input events (useful while auditing page).Voidstatic Script<>setInterceptDrags(boolean enabled)
Prevents default drag and drop behavior and instead emitsInput.dragInterceptedevents.Voidstatic Script<>synthesizePinchGesture(Number x, Number y, Number scaleFactor, Integer relativeSpeed, String gestureSourceType)
Synthesizes a pinch gesture over a time period by issuing appropriate touch events.Voidstatic Script<>synthesizeScrollGesture(Number x, Number y, Number xDistance, Number yDistance, Number xOverscroll, Number yOverscroll, Boolean preventFling, Integer speed, String gestureSourceType, Integer repeatCount, Integer repeatDelayMs, String interactionMarkerName)
Synthesizes a scroll gesture over a time period by issuing appropriate touch events.Voidstatic Script<>synthesizeTapGesture(Number x, Number y, Integer duration, Integer tapCount, String gestureSourceType)
Synthesizes a tap gesture over a time period by issuing appropriate touch events.Input Domain CommandBuilder Methods Modifier and Type Method Description static CommandBuilder
<Void>dispatchDragEvent()Creates a buider for conveniently assigning parameters to this method.static CommandBuilder
<Void>dispatchKeyEvent()Creates a buider for conveniently assigning parameters to this method.static CommandBuilder
<Void>dispatchMouseEvent()Creates a buider for conveniently assigning parameters to this method.static CommandBuilder
<Void>emulateTouchFromMouseEvent()Creates a buider for conveniently assigning parameters to this method.static CommandBuilder
<Void>imeSetComposition()Creates a buider for conveniently assigning parameters to this method.static CommandBuilder
<Void>synthesizePinchGesture()Creates a buider for conveniently assigning parameters to this method.static CommandBuilder
<Void>synthesizeScrollGesture()Creates a buider for conveniently assigning parameters to this method.static CommandBuilder
<Void>synthesizeTapGesture()Creates a buider for conveniently assigning parameters to this method.
-
-
-
Field Detail
-
TimeSinceEpoch
public static final java.lang.String TimeSinceEpoch
UTC time in seconds, counted from January 1, 1970.
The TypeTimeSinceEpochhas been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simpleStringConstant, for documentation & reference purposes only.
The code which is generated which employs this type replaces its use with the Standard Java-Type:Number
Eliminated Type- See Also:
- Constant Field Values
-
GestureSourceType
public static final ReadOnlyList<java.lang.String> GestureSourceType
[No Description Provided by Google]
EXPERIMENTAL
String-Enumeration Type
-
MouseButton
public static final ReadOnlyList<java.lang.String> MouseButton
[No Description Provided by Google]
String-Enumeration Type
-
-
Method Detail
-
cancelDragging
public static Script<java.lang.Void> cancelDragging()
Cancels any active dragging in the page.
-
dispatchDragEvent
public static Script<java.lang.Void> dispatchDragEvent (java.lang.String type, java.lang.Number x, java.lang.Number y, Input.DragData data, java.lang.Integer modifiers)
Dispatches a drag event into the page.
EXPERIMENTAL👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:dispatchDragEvent()- Parameters:
type- Type of the drag event.
Acceptable Values: ["dragCancel", "dragEnter", "dragOver", "drop"]x- X coordinate of the event relative to the main frame's viewport in CSS pixels.y- Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.data- -modifiers- Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
dispatchKeyEvent
public static Script<java.lang.Void> dispatchKeyEvent (java.lang.String type, java.lang.Integer modifiers, java.lang.Number timestamp, java.lang.String text, java.lang.String unmodifiedText, java.lang.String keyIdentifier, java.lang.String code, java.lang.String key, java.lang.Integer windowsVirtualKeyCode, java.lang.Integer nativeVirtualKeyCode, java.lang.Boolean autoRepeat, java.lang.Boolean isKeypad, java.lang.Boolean isSystemKey, java.lang.Integer location, java.lang.String[] commands)
Dispatches a key event to the page.👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:dispatchKeyEvent()- Parameters:
type- Type of the key event.
Acceptable Values: ["char", "keyDown", "keyUp", "rawKeyDown"]modifiers- Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
OPTIONALtimestamp- Time at which the event occurred.
OPTIONALtext- Text as generated by processing a virtual key code with a keyboard layout. Not needed for forkeyUpandrawKeyDownevents (default: "")
OPTIONALunmodifiedText- Text that would have been generated by the keyboard if no modifiers were pressed (except for shift). Useful for shortcut (accelerator) key handling (default: "").
OPTIONALkeyIdentifier- Unique key identifier (e.g., 'U+0041') (default: "").
OPTIONALcode- Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
OPTIONALkey- Unique DOM defined string value describing the meaning of the key in the context of active modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
OPTIONALwindowsVirtualKeyCode- Windows virtual key code (default: 0).
OPTIONALnativeVirtualKeyCode- Native virtual key code (default: 0).
OPTIONALautoRepeat- Whether the event was generated from auto repeat (default: false).
OPTIONALisKeypad- Whether the event was generated from the keypad (default: false).
OPTIONALisSystemKey- Whether the event was a system key event (default: false).
OPTIONALlocation- Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: 0).
OPTIONALcommands- Editing commands to send with the key event (e.g., 'selectAll') (default: []). These are related to but not equal the command names used indocument.execCommandand NSStandardKeyBindingResponding. See https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h for valid command names.
OPTIONALEXPERIMENTAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
dispatchMouseEvent
public static Script<java.lang.Void> dispatchMouseEvent (java.lang.String type, java.lang.Number x, java.lang.Number y, java.lang.Integer modifiers, java.lang.Number timestamp, java.lang.String button, java.lang.Integer buttons, java.lang.Integer clickCount, java.lang.Number force, java.lang.Number tangentialPressure, java.lang.Number tiltX, java.lang.Number tiltY, java.lang.Integer twist, java.lang.Number deltaX, java.lang.Number deltaY, java.lang.String pointerType)
Dispatches a mouse event to the page.👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:dispatchMouseEvent()- Parameters:
type- Type of the mouse event.
Acceptable Values: ["mouseMoved", "mousePressed", "mouseReleased", "mouseWheel"]x- X coordinate of the event relative to the main frame's viewport in CSS pixels.y- Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.modifiers- Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
OPTIONALtimestamp- Time at which the event occurred.
OPTIONALbutton- Mouse button (default: "none").
OPTIONALbuttons- A number indicating which buttons are pressed on the mouse when a mouse event is triggered. Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0.
OPTIONALclickCount- Number of times the mouse button was clicked (default: 0).
OPTIONALforce- The normalized pressure, which has a range of [0,1] (default: 0).
OPTIONALEXPERIMENTALtangentialPressure- The normalized tangential pressure, which has a range of [-1,1] (default: 0).
OPTIONALEXPERIMENTALtiltX- The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range [-90,90], a positive tiltX is to the right (default: 0).
OPTIONALtiltY- The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range [-90,90], a positive tiltY is towards the user (default: 0).
OPTIONALtwist- The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0).
OPTIONALEXPERIMENTALdeltaX- X delta in CSS pixels for mouse wheel event (default: 0).
OPTIONALdeltaY- Y delta in CSS pixels for mouse wheel event (default: 0).
OPTIONALpointerType- Pointer type (default: "mouse").
Acceptable Values: ["mouse", "pen"]
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
dispatchTouchEvent
public static Script<java.lang.Void> dispatchTouchEvent (java.lang.String type, Input.TouchPoint[] touchPoints, java.lang.Integer modifiers, java.lang.Number timestamp)
Dispatches a touch event to the page.- Parameters:
type- Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while TouchStart and TouchMove must contains at least one.
Acceptable Values: ["touchCancel", "touchEnd", "touchMove", "touchStart"]touchPoints- Active touch points on the touch device. One event per any changed point (compared to previous touch event in a sequence) is generated, emulating pressing/moving/releasing points one by one.modifiers- Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
OPTIONALtimestamp- Time at which the event occurred.
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
emulateTouchFromMouseEvent
public static Script<java.lang.Void> emulateTouchFromMouseEvent (java.lang.String type, int x, int y, java.lang.String button, java.lang.Number timestamp, java.lang.Number deltaX, java.lang.Number deltaY, java.lang.Integer modifiers, java.lang.Integer clickCount)
Emulates touch event from the mouse event parameters.
EXPERIMENTAL👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:emulateTouchFromMouseEvent()- Parameters:
type- Type of the mouse event.
Acceptable Values: ["mouseMoved", "mousePressed", "mouseReleased", "mouseWheel"]x- X coordinate of the mouse pointer in DIP.y- Y coordinate of the mouse pointer in DIP.button- Mouse button. Only "none", "left", "right" are supported.timestamp- Time at which the event occurred (default: current time).
OPTIONALdeltaX- X delta in DIP for mouse wheel event (default: 0).
OPTIONALdeltaY- Y delta in DIP for mouse wheel event (default: 0).
OPTIONALmodifiers- Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
OPTIONALclickCount- Number of times the mouse button was clicked (default: 0).
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
imeSetComposition
public static Script<java.lang.Void> imeSetComposition (java.lang.String text, int selectionStart, int selectionEnd, java.lang.Integer replacementStart, java.lang.Integer replacementEnd)
This method sets the current candidate text for IME. Use imeCommitComposition to commit the final text. Use imeSetComposition with empty string as text to cancel composition.
EXPERIMENTAL👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:imeSetComposition()- Parameters:
text- The text to insertselectionStart- selection startselectionEnd- selection endreplacementStart- replacement start
OPTIONALreplacementEnd- replacement end
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
insertText
public static Script<java.lang.Void> insertText(java.lang.String text)
This method emulates inserting text that doesn't come from a key press, for example an emoji keyboard or an IME.
EXPERIMENTAL- Parameters:
text- The text to insert.- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
setIgnoreInputEvents
public static Script<java.lang.Void> setIgnoreInputEvents(boolean ignore)
Ignores input events (useful while auditing page).- Parameters:
ignore- Ignores input events processing when set to true.- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
setInterceptDrags
public static Script<java.lang.Void> setInterceptDrags(boolean enabled)
Prevents default drag and drop behavior and instead emitsInput.dragInterceptedevents. Drag and drop behavior can be directly controlled viaInput.dispatchDragEvent.
EXPERIMENTAL- Parameters:
enabled- -- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
synthesizePinchGesture
public static Script<java.lang.Void> synthesizePinchGesture (java.lang.Number x, java.lang.Number y, java.lang.Number scaleFactor, java.lang.Integer relativeSpeed, java.lang.String gestureSourceType)
Synthesizes a pinch gesture over a time period by issuing appropriate touch events.
EXPERIMENTAL👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:synthesizePinchGesture()- Parameters:
x- X coordinate of the start of the gesture in CSS pixels.y- Y coordinate of the start of the gesture in CSS pixels.scaleFactor- Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out).relativeSpeed- Relative pointer speed in pixels per second (default: 800).
OPTIONALgestureSourceType- Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
synthesizeScrollGesture
public static Script<java.lang.Void> synthesizeScrollGesture (java.lang.Number x, java.lang.Number y, java.lang.Number xDistance, java.lang.Number yDistance, java.lang.Number xOverscroll, java.lang.Number yOverscroll, java.lang.Boolean preventFling, java.lang.Integer speed, java.lang.String gestureSourceType, java.lang.Integer repeatCount, java.lang.Integer repeatDelayMs, java.lang.String interactionMarkerName)
Synthesizes a scroll gesture over a time period by issuing appropriate touch events.
EXPERIMENTAL👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:synthesizeScrollGesture()- Parameters:
x- X coordinate of the start of the gesture in CSS pixels.y- Y coordinate of the start of the gesture in CSS pixels.xDistance- The distance to scroll along the X axis (positive to scroll left).
OPTIONALyDistance- The distance to scroll along the Y axis (positive to scroll up).
OPTIONALxOverscroll- The number of additional pixels to scroll back along the X axis, in addition to the given distance.
OPTIONALyOverscroll- The number of additional pixels to scroll back along the Y axis, in addition to the given distance.
OPTIONALpreventFling- Prevent fling (default: true).
OPTIONALspeed- Swipe speed in pixels per second (default: 800).
OPTIONALgestureSourceType- Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
OPTIONALrepeatCount- The number of times to repeat the gesture (default: 0).
OPTIONALrepeatDelayMs- The number of milliseconds delay between each repeat. (default: 250).
OPTIONALinteractionMarkerName- The name of the interaction markers to generate, if not empty (default: "").
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
synthesizeTapGesture
public static Script<java.lang.Void> synthesizeTapGesture (java.lang.Number x, java.lang.Number y, java.lang.Integer duration, java.lang.Integer tapCount, java.lang.String gestureSourceType)
Synthesizes a tap gesture over a time period by issuing appropriate touch events.
EXPERIMENTAL👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:synthesizeTapGesture()- Parameters:
x- X coordinate of the start of the gesture in CSS pixels.y- Y coordinate of the start of the gesture in CSS pixels.duration- Duration between touchdown and touchup events in ms (default: 50).
OPTIONALtapCount- Number of times to perform the tap (e.g. 2 for double tap, default: 1).
OPTIONALgestureSourceType- Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance must be executed before the browser receives the invocation-request.This Browser-Function does not have a return-value. You may choose to await thePromise<Void>to ensure that the Browser Function has run to completion.
-
dispatchDragEvent
public static CommandBuilder<java.lang.Void> dispatchDragEvent()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 5 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
dispatchDragEvent(java.lang.String, java.lang.Number, java.lang.Number, Torello.Browser.BrowserAPI.Input.DragData, java.lang.Integer)
-
dispatchKeyEvent
public static CommandBuilder<java.lang.Void> dispatchKeyEvent()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 15 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
dispatchKeyEvent(java.lang.String, java.lang.Integer, java.lang.Number, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Integer, java.lang.String[])
-
dispatchMouseEvent
public static CommandBuilder<java.lang.Void> dispatchMouseEvent()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 16 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
dispatchMouseEvent(java.lang.String, java.lang.Number, java.lang.Number, java.lang.Integer, java.lang.Number, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Number, java.lang.Number, java.lang.Number, java.lang.Number, java.lang.Integer, java.lang.Number, java.lang.Number, java.lang.String)
-
emulateTouchFromMouseEvent
public static CommandBuilder<java.lang.Void> emulateTouchFromMouseEvent()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 9 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
emulateTouchFromMouseEvent(java.lang.String, int, int, java.lang.String, java.lang.Number, java.lang.Number, java.lang.Number, java.lang.Integer, java.lang.Integer)
-
imeSetComposition
public static CommandBuilder<java.lang.Void> imeSetComposition()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 5 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
imeSetComposition(java.lang.String, int, int, java.lang.Integer, java.lang.Integer)
-
synthesizePinchGesture
public static CommandBuilder<java.lang.Void> synthesizePinchGesture()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 5 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
synthesizePinchGesture(java.lang.Number, java.lang.Number, java.lang.Number, java.lang.Integer, java.lang.String)
-
synthesizeScrollGesture
public static CommandBuilder<java.lang.Void> synthesizeScrollGesture()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 12 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
synthesizeScrollGesture(java.lang.Number, java.lang.Number, java.lang.Number, java.lang.Number, java.lang.Number, java.lang.Number, java.lang.Boolean, java.lang.Integer, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.String)
-
synthesizeTapGesture
public static CommandBuilder<java.lang.Void> synthesizeTapGesture()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 5 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
synthesizeTapGesture(java.lang.Number, java.lang.Number, java.lang.Integer, java.lang.Integer, java.lang.String)
-
-