Class DriverApi
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasSupplier(Object arg, io.karatelabs.js.Context ctx) Adapt a JS/Java callable argument to aSupplier<Object>.static voidbindJsHelpers(io.karatelabs.js.Engine engine, Driver driver) Bind driver action methods as global functions.resolveFilePaths(String... refs) Resolve file-path references forDriver.inputFile(String, String...)to absolute OS paths, using the SAME rule asread(): a bare path is relative to the calling feature's dir, a leading/anchors the project root,classpath:is classloader-first with a root fallback, andthis:is the feature's dir.
-
Field Details
-
CLICK
- See Also:
-
INPUT
- See Also:
-
INPUT_FILE
- See Also:
-
CLEAR
- See Also:
-
FOCUS
- See Also:
-
SCROLL
- See Also:
-
HIGHLIGHT
- See Also:
-
HIGHLIGHT_ALL
- See Also:
-
SELECT
- See Also:
-
SUBMIT
- See Also:
-
TEXT
- See Also:
-
HTML
- See Also:
-
VALUE
- See Also:
-
ATTRIBUTE
- See Also:
-
PROPERTY
- See Also:
-
EXISTS
- See Also:
-
ENABLED
- See Also:
-
POSITION
- See Also:
-
LOCATE
- See Also:
-
LOCATE_ALL
- See Also:
-
OPTIONAL
- See Also:
-
WAIT_FOR
- See Also:
-
WAIT_FOR_ANY
- See Also:
-
WAIT_FOR_TEXT
- See Also:
-
WAIT_FOR_ENABLED
- See Also:
-
WAIT_FOR_URL
- See Also:
-
WAIT_UNTIL
- See Also:
-
WAIT_FOR_RESULT_COUNT
- See Also:
-
SWITCH_FRAME
- See Also:
-
SWITCH_PAGE
- See Also:
-
GET_PAGES
- See Also:
-
SCRIPT
- See Also:
-
SCRIPT_ALL
- See Also:
-
REFRESH
- See Also:
-
RELOAD
- See Also:
-
BACK
- See Also:
-
FORWARD
- See Also:
-
MAXIMIZE
- See Also:
-
MINIMIZE
- See Also:
-
FULLSCREEN
- See Also:
-
ACTIVATE
- See Also:
-
CLOSE
- See Also:
-
QUIT
- See Also:
-
SCREENSHOT
- See Also:
-
PDF
- See Also:
-
COOKIE
- See Also:
-
COOKIES_SET
- See Also:
-
CLEAR_COOKIES
- See Also:
-
DELETE_COOKIE
- See Also:
-
INTERCEPT
- See Also:
-
DIALOG
- See Also:
-
ON_DIALOG
- See Also:
-
DIALOG_TEXT
- See Also:
-
MOUSE
- See Also:
-
KEYS
- See Also:
-
RIGHT_OF
- See Also:
-
LEFT_OF
- See Also:
-
ABOVE
- See Also:
-
BELOW
- See Also:
-
NEAR
- See Also:
-
RETRY
- See Also:
-
TIMEOUT
- See Also:
-
URL
- See Also:
-
TITLE
- See Also:
-
COOKIES
- See Also:
-
DIMENSIONS
- See Also:
-
BOUND_METHODS
-
-
Constructor Details
-
DriverApi
public DriverApi()
-
-
Method Details
-
resolveFilePaths
Resolve file-path references forDriver.inputFile(String, String...)to absolute OS paths, using the SAME rule asread(): a bare path is relative to the calling feature's dir, a leading/anchors the project root,classpath:is classloader-first with a root fallback, andthis:is the feature's dir. Outside a scenario (plain Java API use) a bare path falls back to classloader/CWD semantics.Every resolved reference must exist as a real file on the local disk — a miss fails here, with the resolved path, rather than as an opaque browser-side error. The one exception is the
file:escape hatch, which is pure path math with no existence check: with a remote browser (grid, container) the file may exist only on the machine the browser runs on, and only the user can know that. -
asSupplier
Adapt a JS/Java callable argument to aSupplier<Object>.Karate treats inline JS lambdas as first-class Java callables — the same pattern that powers
karate.filter(list, x => ...). This helper lets driver bindings route a callable argument to theSupplier-taking overload of a method (polled locally in karate-js) rather than coercing it to a string and shipping it off to the browser, where its karate-js scope wouldn't exist.- Returns:
- a
Supplierwrapping the callable, ornullwhen the argument is not a recognised callable (caller should fall through to theStringoverload).
-
bindJsHelpers
Bind driver action methods as global functions. This allows writing `* click('#button')` instead of `* driver.click('#button')`. Reuses JavaCallables from Driver.jsGet() for consistency.
-