From f42426a54c028f5b3228b8a765f1ace3eceb2281 Mon Sep 17 00:00:00 2001 From: soulgalore Date: Wed, 29 May 2024 13:56:32 +0200 Subject: [PATCH] docs: update jsdoc --- docs/documentation/sitespeed.io/scripting/Cache.html | 2 +- docs/documentation/sitespeed.io/scripting/SingleClick.html | 2 +- docs/documentation/sitespeed.io/scripting/Wait.html | 2 +- docs/documentation/sitespeed.io/scripting/data/search.json | 2 +- docs/documentation/sitespeed.io/scripting/index.html | 2 +- .../sitespeed.io/scripting/tutorial-05-Interact-Browser.html | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/documentation/sitespeed.io/scripting/Cache.html b/docs/documentation/sitespeed.io/scripting/Cache.html index 455147ff3..32b572794 100644 --- a/docs/documentation/sitespeed.io/scripting/Cache.html +++ b/docs/documentation/sitespeed.io/scripting/Cache.html @@ -1,3 +1,3 @@ Class: Cache
On this page

Cache

Manage the browser cache. This class provides methods to clear the cache and cookies in different browsers.

Classes

Cache

Methods

(async) clear() → {Promise.<void>}

Clears the browser cache. This includes both cache and cookies. For Firefox, it uses the extensionServer setup with specific options. For Chrome and Edge, it uses the Chrome DevTools Protocol (CDP) commands. If the browser is not supported, logs an error message.
Throws:
Will throw an error if the browser is not supported.
Returns:
A promise that resolves when the cache and cookies are cleared.
Type: 
Promise.<void>
Example
await commands.cache.clear();

(async) clearKeepCookies() → {Promise.<void>}

Clears the browser cache while keeping the cookies. For Firefox, it uses the extensionServer setup with specific options. For Chrome and Edge, it uses the Chrome DevTools Protocol (CDP) command to clear the cache. If the browser is not supported, logs an error message.
Throws:
Will throw an error if the browser is not supported.
Returns:
A promise that resolves when the cache is cleared but cookies are kept.
Type: 
Promise.<void>
Example
await commands.cache.clearKeepCookies();
\ No newline at end of file +
On this page

Cache

Manage the browser cache. This class provides methods to clear the cache and cookies in different browsers.

Classes

Cache

Methods

(async) clear() → {Promise.<void>}

Clears the browser cache. This includes both cache and cookies. For Chrome and Edge, it uses the Chrome DevTools Protocol (CDP) commands. If the browser is not supported, logs an error message.
Throws:
Will throw an error if the browser is not supported.
Returns:
A promise that resolves when the cache and cookies are cleared.
Type: 
Promise.<void>
Example
await commands.cache.clear();

(async) clearKeepCookies() → {Promise.<void>}

Clears the browser cache while keeping the cookies. For Chrome and Edge, it uses the Chrome DevTools Protocol (CDP) command to clear the cache. If the browser is not supported, logs an error message.
Throws:
Will throw an error if the browser is not supported.
Returns:
A promise that resolves when the cache is cleared but cookies are kept.
Type: 
Promise.<void>
Example
await commands.cache.clearKeepCookies();
\ No newline at end of file diff --git a/docs/documentation/sitespeed.io/scripting/SingleClick.html b/docs/documentation/sitespeed.io/scripting/SingleClick.html index 162341d3a..f62975d44 100644 --- a/docs/documentation/sitespeed.io/scripting/SingleClick.html +++ b/docs/documentation/sitespeed.io/scripting/SingleClick.html @@ -1,3 +1,3 @@ Class: SingleClick
On this page

SingleClick

Provides functionality to perform a single click action on elements or at specific positions in a web page. Uses Seleniums Action API.

Classes

SingleClick

Methods

(async) atCursor(optionsopt) → {Promise.<void>}

Performs a single mouse click at the current cursor position.
Parameters:
NameTypeAttributesDescription
optionsObject<optional>
Additional options for the click action.
Throws:
Throws an error if the single click action cannot be performed.
Type
Error
Returns:
A promise that resolves when the single click occurs.
Type: 
Promise.<void>

(async) atCursorAndWait() → {Promise.<void>}

Performs a single mouse click at the current cursor position and waits on the page complete check.
Throws:
Throws an error if the single click action cannot be performed.
Type
Error
Returns:
A promise that resolves when the single click occurs.
Type: 
Promise.<void>

(async) byLinkText(text) → {Promise.<void>}

Clicks on a link whose visible text matches the given string.
Parameters:
NameTypeDescription
textstringThe visible text of the link to click.
Throws:
Throws an error if the link is not found.
Type
Error
Returns:
A promise that resolves when the click action is performed.
Type: 
Promise.<void>

(async) byLinkTextAndWait(text) → {Promise.<void>}

Clicks on a link whose visible text matches the given string and waits on the opage complete check.
Parameters:
NameTypeDescription
textstringThe visible text of the link to click.
Throws:
Throws an error if the link is not found.
Type
Error
Returns:
A promise that resolves when the click action is performed.
Type: 
Promise.<void>

(async) byPartialLinkText(text) → {Promise.<void>}

Clicks on a link whose visible text contains the given substring.
Parameters:
NameTypeDescription
textstringThe substring of the visible text of the link to click.
Throws:
Throws an error if the link is not found.
Type
Error
Returns:
A promise that resolves when the click action is performed.
Type: 
Promise.<void>

(async) byPartialLinkTextAndWait(text) → {Promise.<void>}

Clicks on a link whose visible text contains the given substring and waits on the page complete checl.
Parameters:
NameTypeDescription
textstringThe substring of the visible text of the link to click.
Throws:
Throws an error if the link is not found.
Type
Error
Returns:
A promise that resolves when the click action is performed.
Type: 
Promise.<void>

(async) bySelector(selector, optionsopt) → {Promise.<void>}

Performs a single mouse click on an element matching a given CSS selector.
Parameters:
NameTypeAttributesDescription
selectorstringThe CSS selector of the element to click.
optionsObject<optional>
Additional options for the click action.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the single click action is performed.
Type: 
Promise.<void>

(async) bySelectorAndWait(selector) → {Promise.<void>}

Performs a single mouse click on an element matching a given CSS selector and waits on the page complete check.
Parameters:
NameTypeDescription
selectorstringThe CSS selector of the element to click.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the single click action is performed.
Type: 
Promise.<void>

(async) byXpath(xpath, optionsopt) → {Promise.<void>}

Performs a single mouse click on an element matching a given XPath selector.
Parameters:
NameTypeAttributesDescription
xpathstringThe XPath selector of the element to click.
optionsObject<optional>
Additional options for the click action.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the single click action is performed.
Type: 
Promise.<void>

(async) byXpathAndWait(xpath) → {Promise.<void>}

Performs a single mouse click on an element matching a given XPath selector and wait for page complete check.
Parameters:
NameTypeDescription
xpathstringThe XPath selector of the element to click.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the single click action is performed.
Type: 
Promise.<void>
\ No newline at end of file +
On this page

SingleClick

Provides functionality to perform a single click action on elements or at specific positions in a web page. Uses Seleniums Action API.

Classes

SingleClick

Methods

(async) atCursor(optionsopt) → {Promise.<void>}

Performs a single mouse click at the current cursor position.
Parameters:
NameTypeAttributesDescription
optionsObject<optional>
Additional options for the click action.
Throws:
Throws an error if the single click action cannot be performed.
Type
Error
Returns:
A promise that resolves when the single click occurs.
Type: 
Promise.<void>

(async) atCursorAndWait() → {Promise.<void>}

Performs a single mouse click at the current cursor position and waits on the page complete check.
Throws:
Throws an error if the single click action cannot be performed.
Type
Error
Returns:
A promise that resolves when the single click occurs.
Type: 
Promise.<void>

(async) byId(id) → {Promise.<void>}

Clicks on a element with a specific id.
Parameters:
NameTypeDescription
idstringThe id of the link to click.
Throws:
Throws an error if the id is not found.
Type
Error
Returns:
A promise that resolves when the click action is performed.
Type: 
Promise.<void>

(async) byIdAndWait(id) → {Promise.<void>}

Clicks on a element with a specific id and wait on the page complete check
Parameters:
NameTypeDescription
idstringThe id of the link to click.
Throws:
Throws an error if the id is not found.
Type
Error
Returns:
A promise that resolves when the page has completed.
Type: 
Promise.<void>

(async) byLinkText(text) → {Promise.<void>}

Clicks on a link whose visible text matches the given string.
Parameters:
NameTypeDescription
textstringThe visible text of the link to click.
Throws:
Throws an error if the link is not found.
Type
Error
Returns:
A promise that resolves when the click action is performed.
Type: 
Promise.<void>

(async) byLinkTextAndWait(text) → {Promise.<void>}

Clicks on a link whose visible text matches the given string and waits on the opage complete check.
Parameters:
NameTypeDescription
textstringThe visible text of the link to click.
Throws:
Throws an error if the link is not found.
Type
Error
Returns:
A promise that resolves when the click action is performed.
Type: 
Promise.<void>

(async) byPartialLinkText(text) → {Promise.<void>}

Clicks on a link whose visible text contains the given substring.
Parameters:
NameTypeDescription
textstringThe substring of the visible text of the link to click.
Throws:
Throws an error if the link is not found.
Type
Error
Returns:
A promise that resolves when the click action is performed.
Type: 
Promise.<void>

(async) byPartialLinkTextAndWait(text) → {Promise.<void>}

Clicks on a link whose visible text contains the given substring and waits on the page complete check.
Parameters:
NameTypeDescription
textstringThe substring of the visible text of the link to click.
Throws:
Throws an error if the link is not found.
Type
Error
Returns:
A promise that resolves when the click action is performed.
Type: 
Promise.<void>

(async) bySelector(selector, optionsopt) → {Promise.<void>}

Performs a single mouse click on an element matching a given CSS selector.
Parameters:
NameTypeAttributesDescription
selectorstringThe CSS selector of the element to click.
optionsObject<optional>
Additional options for the click action.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the single click action is performed.
Type: 
Promise.<void>

(async) bySelectorAndWait(selector) → {Promise.<void>}

Performs a single mouse click on an element matching a given CSS selector and waits on the page complete check.
Parameters:
NameTypeDescription
selectorstringThe CSS selector of the element to click.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the single click action is performed.
Type: 
Promise.<void>

(async) byXpath(xpath, optionsopt) → {Promise.<void>}

Performs a single mouse click on an element matching a given XPath selector.
Parameters:
NameTypeAttributesDescription
xpathstringThe XPath selector of the element to click.
optionsObject<optional>
Additional options for the click action.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the single click action is performed.
Type: 
Promise.<void>

(async) byXpathAndWait(xpath) → {Promise.<void>}

Performs a single mouse click on an element matching a given XPath selector and wait for page complete check.
Parameters:
NameTypeDescription
xpathstringThe XPath selector of the element to click.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the single click action is performed.
Type: 
Promise.<void>
\ No newline at end of file diff --git a/docs/documentation/sitespeed.io/scripting/Wait.html b/docs/documentation/sitespeed.io/scripting/Wait.html index 69867f0e2..f007c13e8 100644 --- a/docs/documentation/sitespeed.io/scripting/Wait.html +++ b/docs/documentation/sitespeed.io/scripting/Wait.html @@ -1,3 +1,3 @@ Class: Wait
On this page

Wait

Provides functionality to wait for different conditions in the browser.

Classes

Wait

Methods

(async) byCondition(jsExpression, maxTime) → {Promise.<void>}

Waits for a JavaScript condition to return a truthy value within a maximum time.
Parameters:
NameTypeDescription
jsExpressionstringThe JavaScript expression to evaluate.
maxTimenumberMaximum time to wait in milliseconds.
Throws:
Throws an error if the condition is not met within the specified time.
Type
Error
Returns:
A promise that resolves when the condition becomes truthy or the time times out.
Type: 
Promise.<void>

(async) byId(id, maxTime) → {Promise.<void>}

Waits for an element with a specific ID to appear within a maximum time.
Parameters:
NameTypeDescription
idstringThe ID of the element to wait for.
maxTimenumberMaximum time to wait in milliseconds.
Throws:
Throws an error if the element is not found within the specified time.
Type
Error
Returns:
A promise that resolves when the element is found or the time times out.
Type: 
Promise.<void>

(async) byPageToComplete() → {Promise.<void>}

Waits for the page to finish loading.
Returns:
A promise that resolves when the page complete check has finished.
Type: 
Promise.<void>
Example
async commands.wait.byPageToComplete();

(async) bySelector(selector, maxTime) → {Promise.<void>}

Waits for an element located by a CSS selector to appear within a maximum time.
Parameters:
NameTypeDescription
selectorstringThe CSS selector of the element to wait for.
maxTimenumberMaximum time to wait in milliseconds.
Throws:
Throws an error if the element is not found within the specified time.
Type
Error
Returns:
A promise that resolves when the element is found or the time times out.
Type: 
Promise.<void>

(async) byTime(ms) → {Promise.<void>}

Waits for a specified amount of time.
Parameters:
NameTypeDescription
msnumberThe time in milliseconds to wait.
Returns:
A promise that resolves when the specified time has elapsed.
Type: 
Promise.<void>
Example
async commands.wait.byTime(1000);

(async) byXpath(xpath, maxTime) → {Promise.<void>}

Waits for an element located by XPath to appear within a maximum time.
Parameters:
NameTypeDescription
xpathstringThe XPath of the element to wait for.
maxTimenumberMaximum time to wait in milliseconds.
Throws:
Throws an error if the element is not found within the specified time.
Type
Error
Returns:
A promise that resolves when the element is found or the time times out.
Type: 
Promise.<void>
\ No newline at end of file +
On this page

Wait

Provides functionality to wait for different conditions in the browser.

Classes

Wait

Methods

(async) byCondition(jsExpression, maxTime) → {Promise.<void>}

Waits for a JavaScript condition to return a truthy value within a maximum time.
Parameters:
NameTypeDescription
jsExpressionstringThe JavaScript expression to evaluate.
maxTimenumberMaximum time to wait in milliseconds.
Throws:
Throws an error if the condition is not met within the specified time.
Type
Error
Returns:
A promise that resolves when the condition becomes truthy or the time times out.
Type: 
Promise.<void>

(async) byId(id, maxTime) → {Promise.<void>}

Waits for an element with a specific ID to be located within a maximum time.
Parameters:
NameTypeDescription
idstringThe ID of the element to wait for.
maxTimenumberMaximum time to wait in milliseconds.
Throws:
Throws an error if the element is not found within the specified time.
Type
Error
Returns:
A promise that resolves when the element is found or the time times out.
Type: 
Promise.<void>

(async) byIdAndVisible(id, maxTime) → {Promise.<void>}

Waits for an element with a specific ID to be located and visible within a maximum time.
Parameters:
NameTypeDescription
idstringThe ID of the element to wait for.
maxTimenumberMaximum time to wait in milliseconds.
Throws:
Throws an error if the element is not found within the specified time.
Type
Error
Returns:
A promise that resolves when the element is found or the time times out.
Type: 
Promise.<void>

(async) byPageToComplete() → {Promise.<void>}

Waits for the page to finish loading.
Returns:
A promise that resolves when the page complete check has finished.
Type: 
Promise.<void>
Example
async commands.wait.byPageToComplete();

(async) bySelector(selector, maxTime) → {Promise.<void>}

Waits for an element located by a CSS selector to appear within a maximum time.
Parameters:
NameTypeDescription
selectorstringThe CSS selector of the element to wait for.
maxTimenumberMaximum time to wait in milliseconds.
Throws:
Throws an error if the element is not found within the specified time.
Type
Error
Returns:
A promise that resolves when the element is found or the time times out.
Type: 
Promise.<void>

(async) byTime(ms) → {Promise.<void>}

Waits for a specified amount of time.
Parameters:
NameTypeDescription
msnumberThe time in milliseconds to wait.
Returns:
A promise that resolves when the specified time has elapsed.
Type: 
Promise.<void>
Example
async commands.wait.byTime(1000);

(async) byXpath(xpath, maxTime) → {Promise.<void>}

Waits for an element located by XPath to appear within a maximum time.
Parameters:
NameTypeDescription
xpathstringThe XPath of the element to wait for.
maxTimenumberMaximum time to wait in milliseconds.
Throws:
Throws an error if the element is not found within the specified time.
Type
Error
Returns:
A promise that resolves when the element is found or the time times out.
Type: 
Promise.<void>
\ No newline at end of file diff --git a/docs/documentation/sitespeed.io/scripting/data/search.json b/docs/documentation/sitespeed.io/scripting/data/search.json index 914f060de..28f9f85a4 100644 --- a/docs/documentation/sitespeed.io/scripting/data/search.json +++ b/docs/documentation/sitespeed.io/scripting/data/search.json @@ -1 +1 @@ -{"list":[{"title":"Actions","link":"Actions"},{"title":"Actions#getActions","link":"getActions","description":"Retrieves the current action sequence builder.\nThe actions builder can be used to chain multiple browser actions."},{"title":"AddText","link":"AddText"},{"title":"AddText#byClassName","link":"byClassName","description":"Adds text to an element identified by its class name."},{"title":"AddText#byId","link":"byId","description":"Adds text to an element identified by its ID."},{"title":"AddText#byName","link":"byName","description":"Adds text to an element identified by its name attribute."},{"title":"AddText#bySelector","link":"bySelector","description":"Adds text to an element identified by its CSS selector."},{"title":"AddText#byXpath","link":"byXpath","description":"Adds text to an element identified by its XPath."},{"title":"AndroidCommand","link":"AndroidCommand"},{"title":"AndroidCommand#shell","link":"shell","description":"Runs a shell command on the connected Android device.\nThis method requires the Android device to be properly configured."},{"title":"AndroidCommand#shellAsRoot","link":"shellAsRoot","description":"Runs a shell command on the connected Android device as the root user.\nThis method requires the Android device to be properly configured and that you\nrooted the device."},{"title":"Bidi","link":"Bidi"},{"title":"Bidi#getRawClient","link":"getRawClient","description":"Retrieves the raw client for Bidi."},{"title":"Bidi#onMessage","link":"onMessage","description":"Add a fanction that will get the events that you subscribes."},{"title":"Bidi#send","link":"send","description":"Sends a command using Bidi."},{"title":"Bidi#subscribe","link":"subscribe","description":"Subscribe to a event."},{"title":"Bidi#unsubscribe","link":"unsubscribe","description":"Unsubscribe to an event."},{"title":"Cache","link":"Cache"},{"title":"Cache#clear","link":"clear","description":"Clears the browser cache. This includes both cache and cookies.\n\nFor Firefox, it uses the extensionServer setup with specific options.\nFor Chrome and Edge, it uses the Chrome DevTools Protocol (CDP) commands.\nIf the browser is not supported, logs an error message."},{"title":"Cache#clearKeepCookies","link":"clearKeepCookies","description":"Clears the browser cache while keeping the cookies.\n\nFor Firefox, it uses the extensionServer setup with specific options.\nFor Chrome and Edge, it uses the Chrome DevTools Protocol (CDP) command to clear the cache.\nIf the browser is not supported, logs an error message."},{"title":"ChromeDevelopmentToolsProtocol","link":"ChromeDevelopmentToolsProtocol"},{"title":"ChromeDevelopmentToolsProtocol#getRawClient","link":"getRawClient","description":"Retrieves the raw client for the DevTools Protocol."},{"title":"ChromeDevelopmentToolsProtocol#on","link":"on","description":"Sets up an event listener for a specific DevTools Protocol event."},{"title":"ChromeDevelopmentToolsProtocol#send","link":"send","description":"Sends a command to the DevTools Protocol."},{"title":"ChromeDevelopmentToolsProtocol#sendAndGet","link":"sendAndGet","description":"Sends a command to the DevTools Protocol and returns the result."},{"title":"ChromeTrace","link":"ChromeTrace"},{"title":"ChromeTrace#start","link":"start","description":"Starts the Chrome trace collection."},{"title":"ChromeTrace#stop","link":"stop","description":"Stops the Chrome trace collection, processes the collected data, and attaches it to the result object."},{"title":"Click","link":"Click"},{"title":"Click#byClassName","link":"byClassName","description":"Clicks on an element identified by its class name."},{"title":"Click#byClassNameAndWait","link":"byClassNameAndWait","description":"Clicks on an element identified by its class name and waits for the page complete check to finish."},{"title":"Click#byId","link":"byId","description":"Clicks on an element located by its ID."},{"title":"Click#byIdAndWait","link":"byIdAndWait","description":"Click on link located by the ID attribute. Uses document.getElementById() to find the element. And wait for page complete check to finish."},{"title":"Click#byJs","link":"byJs","description":"Clicks on an element located by evaluating a JavaScript expression."},{"title":"Click#byJsAndWait","link":"byJsAndWait","description":"Clicks on an element located by evaluating a JavaScript expression and waits for the page complete check to finish."},{"title":"Click#byLinkText","link":"byLinkText","description":"Clicks on a link whose visible text matches the given string."},{"title":"Click#byLinkTextAndWait","link":"byLinkTextAndWait","description":"Clicks on a link whose visible text matches the given string and waits for the page complete check to finish."},{"title":"Click#byName","link":"byName","description":"Clicks on an element located by its name attribute."},{"title":"Click#byPartialLinkText","link":"byPartialLinkText","description":"Clicks on a link whose visible text contains the given substring."},{"title":"Click#byPartialLinkTextAndWait","link":"byPartialLinkTextAndWait","description":"Clicks on a link whose visible text contains the given substring and waits for the page complete check to finish."},{"title":"Click#bySelector","link":"bySelector","description":"Clicks on an element located by its CSS selector."},{"title":"Click#bySelectorAndWait","link":"bySelectorAndWait","description":"Clicks on an element located by its CSS selector and waits for the page complete check to finish."},{"title":"Click#byXpath","link":"byXpath","description":"Clicks on an element that matches a given XPath selector."},{"title":"Click#byXpathAndWait","link":"byXpathAndWait","description":"Clicks on an element that matches a given XPath selector and waits for the page complete check to finish."},{"title":"ClickAndHold","link":"ClickAndHold"},{"title":"ClickAndHold#atCursor","link":"atCursor","description":"Clicks and holds at the current cursor position."},{"title":"ClickAndHold#atPosition","link":"atPosition","description":"Clicks and holds at the specified screen coordinates."},{"title":"ClickAndHold#bySelector","link":"bySelector","description":"Clicks and holds on an element that matches a given CSS selector."},{"title":"ClickAndHold#byXpath","link":"byXpath","description":"Clicks and holds on an element that matches a given XPath selector."},{"title":"ClickAndHold#releaseAtPosition","link":"releaseAtPosition","description":"Releases the mouse button at the specified screen coordinates."},{"title":"ClickAndHold#releaseAtSelector","link":"releaseAtSelector","description":"Releases the mouse button on an element matching the specified CSS selector."},{"title":"ClickAndHold#releaseAtXpath","link":"releaseAtXpath","description":"Releases the mouse button on an element matching the specified XPath."},{"title":"Commands","link":"Commands"},{"title":"Commands#action","link":"action","description":"Selenium's action sequence functionality."},{"title":"Commands#addText","link":"addText","description":"Provides functionality to add text to elements on a web page using various selectors."},{"title":"Commands#android","link":"android","description":"Provides commands for interacting with an Android device."},{"title":"Commands#bidi","link":"bidi","description":"Use WebDriver Bidi. Availible in Firefox and in the future more browsers."},{"title":"Commands#cache","link":"cache","description":"Manages the browser's cache."},{"title":"Commands#cdp","link":"cdp","description":"Use the Chrome DevTools Protocol, available in Chrome and Edge."},{"title":"Commands#click","link":"click","description":"Provides functionality to perform click actions on elements in a web page using various selectors."},{"title":"Commands#debug","link":"debug","description":"Provides debugging capabilities within a browser automation script.\nIt allows setting breakpoints to pause script execution and inspect the current state."},{"title":"Commands#element","link":"element","description":"Get Selenium's WebElements."},{"title":"Commands#error","link":"error","description":"Add a text that will be an error attached to the current page."},{"title":"Commands#js","link":"js","description":"Executes JavaScript in the browser context."},{"title":"Commands#markAsFailure","link":"markAsFailure","description":"Mark this run as an failure. Add a message that explains the failure."},{"title":"Commands#measure","link":"measure","description":"Provides functionality for measuring a navigation."},{"title":"Commands#meta","link":"meta","description":"Adds metadata to the user journey."},{"title":"Commands#mouse","link":"mouse","description":"Interact with the page using the mouse."},{"title":"Commands#mouse.clickAndHold","link":"clickAndHold","description":"Provides functionality to click and hold elements on a web page using different strategies."},{"title":"Commands#mouse.contextClick","link":"contextClick","description":"Perform a context click (right-click) on elements in a web page."},{"title":"Commands#mouse.doubleClick","link":"doubleClick","description":"Provides functionality to perform a double-click action on elements in a web page."},{"title":"Commands#mouse.moveTo","link":"moveTo","description":"Move the mouse cursor to elements or specific positions on a web page."},{"title":"Commands#mouse.singleClick","link":"singleClick","description":"Provides functionality to perform a single click action on elements or at specific positions in a web page."},{"title":"Commands#navigate","link":"navigate","description":"Navigates to a specified URL and handles additional setup for a page visit."},{"title":"Commands#navigation","link":"navigation","description":"Provides functionality to control browser navigation such as back, forward, and refresh actions."},{"title":"Commands#screenshot","link":"screenshot","description":"Takes and manages screenshots."},{"title":"Commands#scroll","link":"scroll","description":"Provides functionality to control page scrolling in the browser."},{"title":"Commands#select","link":"select","description":"Interact with a select element."},{"title":"Commands#set","link":"set","description":"Sets values on HTML elements in the page."},{"title":"Commands#stopWatch","link":"stopWatch","description":"Stopwatch utility for measuring time intervals."},{"title":"Commands#switch","link":"switch","description":"Switches context to different frames, windows, or tabs in the browser."},{"title":"Commands#trace","link":"trace","description":"Manages Chrome trace functionality, enabling custom profiling and trace collection in Chrome."},{"title":"Commands#wait","link":"wait","description":"Provides functionality to wait for different conditions in the browser."},{"title":"ContextClick","link":"ContextClick"},{"title":"ContextClick#atCursor","link":"atCursor","description":"Performs a context click (right-click) at the current cursor position."},{"title":"ContextClick#bySelector","link":"bySelector","description":"Performs a context click (right-click) on an element that matches a given CSS selector."},{"title":"ContextClick#byXpath","link":"byXpath","description":"Performs a context click (right-click) on an element that matches a given XPath selector."},{"title":"Debug","link":"Debug"},{"title":"Debug#breakpoint","link":"breakpoint","description":"Adds a breakpoint to the script. The browser will pause at the breakpoint, waiting for user input to continue.\nThis is useful for debugging and inspecting the browser state at a specific point in the script."},{"title":"DoubleClick","link":"DoubleClick"},{"title":"DoubleClick#atCursor","link":"atCursor","description":"Performs a mouse double-click at the current cursor position."},{"title":"DoubleClick#bySelector","link":"bySelector","description":"Performs a mouse double-click on an element matching a given CSS selector."},{"title":"DoubleClick#byXpath","link":"byXpath","description":"Performs a mouse double-click on an element matching a given XPath selector."},{"title":"Element","link":"Element"},{"title":"Element#getByClassName","link":"getByClassName","description":"Finds an element by its class name."},{"title":"Element#getByCss","link":"getByCss","description":"Finds an element by its CSS selector."},{"title":"Element#getById","link":"getById","description":"Finds an element by its ID."},{"title":"Element#getByName","link":"getByName","description":"Finds an element by its name attribute."},{"title":"Element#getByXpath","link":"getByXpath","description":"Finds an element by its XPath."},{"title":"GeckoProfiler","link":"GeckoProfiler"},{"title":"GeckoProfiler#start","link":"start","description":"Starts the Gecko Profiler."},{"title":"GeckoProfiler#stop","link":"stop","description":"Stops the Gecko Profiler and processes the collected data."},{"title":"JavaScript","link":"JavaScript"},{"title":"JavaScript#run","link":"run","description":"Executes a JavaScript script."},{"title":"JavaScript#runAndWait","link":"runAndWait","description":"Executes a JavaScript script and waits for the page complete check to finish."},{"title":"JavaScript#runPrivileged","link":"runPrivileged","description":"Executes synchronous privileged JavaScript."},{"title":"JavaScript#runPrivilegedAndWait","link":"runPrivilegedAndWait","description":"Executes synchronous privileged JavaScript and waits for the page complete check to finish."},{"title":"JavaScript#runPrivilegedAsync","link":"runPrivilegedAsync","description":"Executes asynchronous privileged JavaScript."},{"title":"Measure","link":"Measure"},{"title":"Measure#add","link":"add","description":"Adds a custom metric to the current measurement result.\nThis method should be called after a measurement has started and before it has stopped."},{"title":"Measure#addObject","link":"addObject","description":"Adds multiple custom metrics to the current measurement result.\nThis method accepts an object containing multiple key-value pairs representing different metrics.\nSimilar to `add`, it should be used within an active measurement cycle."},{"title":"Measure#start","link":"start","description":"Starts the measurement process for a given URL or an alias.\n\nIt supports starting measurements by either directly providing a URL or using an alias.\nIf a URL is provided, it navigates to that URL and performs the measurement.\nIf an alias is provided, or no URL is available, it sets up the environment for a user-driven navigation."},{"title":"Measure#stop","link":"stop","description":"Stops the measurement process, collects metrics, and handles any post-measurement tasks.\nIt finalizes the URL being tested, manages any URL-specific metadata, stops any ongoing video recordings,\nand initiates the data collection process."},{"title":"Measure#stopAsError","link":"stopAsError","description":"Stop the current measurement and mark it as a failure. This stop function will not measure anything on a page. This is useful if you need to stop a measurement in a (try) catch and you\nknow something has failed."},{"title":"Meta","link":"Meta"},{"title":"Meta#setDescription","link":"setDescription","description":"Sets the description for the user journey."},{"title":"Meta#setTitle","link":"setTitle","description":"Sets the title for the user journey."},{"title":"MouseMove","link":"MouseMove"},{"title":"MouseMove#byOffset","link":"byOffset","description":"Moves the mouse cursor by an offset from its current position."},{"title":"MouseMove#bySelector","link":"bySelector","description":"Moves the mouse cursor to an element that matches a given CSS selector."},{"title":"MouseMove#byXpath","link":"byXpath","description":"Moves the mouse cursor to an element that matches a given XPath selector."},{"title":"MouseMove#toPosition","link":"toPosition","description":"Moves the mouse cursor to a specific position on the screen."},{"title":"Navigation","link":"Navigation"},{"title":"Navigation#back","link":"back","description":"Navigates backward in the browser's history."},{"title":"Navigation#forward","link":"forward","description":"Navigates forward in the browser's history."},{"title":"Navigation#refresh","link":"refresh","description":"Refreshes the current page."},{"title":"Screenshot","link":"Screenshot"},{"title":"Screenshot#take","link":"take","description":"Takes a screenshot and saves it using the screenshot manager."},{"title":"Scroll","link":"Scroll"},{"title":"Scroll#byLines","link":"byLines","description":"Scrolls the page by the specified number of lines. This method is only supported in Firefox."},{"title":"Scroll#byPages","link":"byPages","description":"Scrolls the page by the specified number of pages."},{"title":"Scroll#byPixels","link":"byPixels","description":"Scrolls the page by the specified number of pixels."},{"title":"Scroll#toBottom","link":"toBottom","description":"Scrolls to the bottom of the page, scrolling page by page with a delay between each scroll."},{"title":"Select","link":"Select"},{"title":"Select#deselectById","link":"deselectById","description":"Deselects all options in a `` element by its ID."},{"title":"Select#getValuesById","link":"getValuesById","description":"Retrieves all option values in a `` element by its ID and the index of the option."},{"title":"Select#selectByIdAndValue","link":"selectByIdAndValue","description":"Selects an option in a `` element by its name and the index of the option."},{"title":"Select#selectByNameAndValue","link":"selectByNameAndValue","description":"Selects an option in a `` element by its ID."},{"title":"Select#getSelectedValueById","link":"getSelectedValueById","description":"Retrieves the value of the selected option in a `` element by its ID."},{"title":"Select#selectByIdAndIndex","link":"selectByIdAndIndex","description":"Selects an option in a `` element by its ID and the value of the option."},{"title":"Select#selectByNameAndIndex","link":"selectByNameAndIndex","description":"Selects an option in a `` element by its name and the value of the option."},{"title":"Set","link":"Set"},{"title":"Set#innerHtml","link":"innerHtml","description":"Sets the innerHTML of an element using a CSS selector."},{"title":"Set#innerHtmlById","link":"innerHtmlById","description":"Sets the innerHTML of an element using its ID."},{"title":"Set#innerText","link":"innerText","description":"Sets the innerText of an element using a CSS selector."},{"title":"Set#innerTextById","link":"innerTextById","description":"Sets the innerText of an element using its ID."},{"title":"Set#value","link":"value","description":"Sets the value of an element using a CSS selector."},{"title":"Set#valueById","link":"valueById","description":"Sets the value of an element using its ID."},{"title":"SingleClick","link":"SingleClick"},{"title":"SingleClick#atCursor","link":"atCursor","description":"Performs a single mouse click at the current cursor position."},{"title":"SingleClick#atCursorAndWait","link":"atCursorAndWait","description":"Performs a single mouse click at the current cursor position and waits on the\npage complete check."},{"title":"SingleClick#byId","link":"byId","description":"Clicks on a element with a specific id."},{"title":"SingleClick#byIdAndWait","link":"byIdAndWait","description":"Clicks on a element with a specific id and wait on the page complete check"},{"title":"SingleClick#byLinkText","link":"byLinkText","description":"Clicks on a link whose visible text matches the given string."},{"title":"SingleClick#byLinkTextAndWait","link":"byLinkTextAndWait","description":"Clicks on a link whose visible text matches the given string and waits on the opage complete check."},{"title":"SingleClick#byPartialLinkText","link":"byPartialLinkText","description":"Clicks on a link whose visible text contains the given substring."},{"title":"SingleClick#byPartialLinkTextAndWait","link":"byPartialLinkTextAndWait","description":"Clicks on a link whose visible text contains the given substring and waits on the\npage complete check."},{"title":"SingleClick#bySelector","link":"bySelector","description":"Performs a single mouse click on an element matching a given CSS selector."},{"title":"SingleClick#bySelectorAndWait","link":"bySelectorAndWait","description":"Performs a single mouse click on an element matching a given CSS selector and waits on the page complete check."},{"title":"SingleClick#byXpath","link":"byXpath","description":"Performs a single mouse click on an element matching a given XPath selector."},{"title":"SingleClick#byXpathAndWait","link":"byXpathAndWait","description":"Performs a single mouse click on an element matching a given XPath selector and wait for page complete check."},{"title":"StopWatch","link":"StopWatch"},{"title":"StopWatch#getName","link":"getName","description":"Gets the name of the stopwatch."},{"title":"StopWatch#start","link":"start","description":"Starts the stopwatch."},{"title":"StopWatch#stop","link":"stop","description":"Stops the stopwatch."},{"title":"StopWatch#stopAndAdd","link":"stopAndAdd","description":"Stops the stopwatch and automatically adds the measured time to the\nlast measured page. Logs an error if no page has been measured."},{"title":"Switch","link":"Switch"},{"title":"Switch#toFrame","link":"toFrame","description":"Switches to a frame identified by its ID."},{"title":"Switch#toFrameBySelector","link":"toFrameBySelector","description":"Switches to a frame identified by a CSS selector."},{"title":"Switch#toFrameByXpath","link":"toFrameByXpath","description":"Switches to a frame identified by an XPath."},{"title":"Switch#toNewTab","link":"toNewTab","description":"Opens a new tab and optionally navigates to a URL."},{"title":"Switch#toNewWindow","link":"toNewWindow","description":"Opens a new window and optionally navigates to a URL."},{"title":"Switch#toParentFrame","link":"toParentFrame","description":"Switches to the parent frame of the current frame."},{"title":"Switch#toWindow","link":"toWindow","description":"Switches to a window identified by its name."},{"title":"Wait","link":"Wait"},{"title":"Wait#byCondition","link":"byCondition","description":"Waits for a JavaScript condition to return a truthy value within a maximum time."},{"title":"Wait#byId","link":"byId","description":"Waits for an element with a specific ID to be located within a maximum time."},{"title":"Wait#byIdAndVisible","link":"byIdAndVisible","description":"Waits for an element with a specific ID to be located and visible within a maximum time."},{"title":"Wait#byPageToComplete","link":"byPageToComplete","description":"Waits for the page to finish loading."},{"title":"Wait#bySelector","link":"bySelector","description":"Waits for an element located by a CSS selector to appear within a maximum time."},{"title":"Wait#byTime","link":"byTime","description":"Waits for a specified amount of time."},{"title":"Wait#byXpath","link":"byXpath","description":"Waits for an element located by XPath to appear within a maximum time."}]} \ No newline at end of file diff --git a/docs/documentation/sitespeed.io/scripting/index.html b/docs/documentation/sitespeed.io/scripting/index.html index 83269f6e5..ffa7ce269 100644 --- a/docs/documentation/sitespeed.io/scripting/index.html +++ b/docs/documentation/sitespeed.io/scripting/index.html @@ -1,3 +1,3 @@ Tutorials and documentation for scripting in Browsertime and sitespeed.io
On this page

Scripting

The user journey

Welcome to the powerful world of scripting with sitespeed.io! This feature unlocks the potential to simulate real user journeys, measure performance, and gather detailed metrics by interacting with web pages through custom scripts. Whether you're looking to analyze simple page loads or complex user interactions, our scripting functionality offers the tools you need.

Key Features

  • User Journey Simulation: Script entire user flows, from navigation to clicks and form submissions, to capture a realistic user experience.
  • Performance Metrics Collection: Gather crucial data like load times, visual metrics, and more, for each step of your user journey.
  • Flexible Scripting Language: Write scripts in NodeJS, using familiar JavaScript syntax and robust libraries.

Getting Started

Dive into scripting with our tutorials, examples, and documentation for all commands.

\ No newline at end of file +
On this page

Scripting

The user journey

Welcome to the powerful world of scripting with sitespeed.io! This feature unlocks the potential to simulate real user journeys, measure performance, and gather detailed metrics by interacting with web pages through custom scripts. Whether you're looking to analyze simple page loads or complex user interactions, our scripting functionality offers the tools you need.

Key Features

  • User Journey Simulation: Script entire user flows, from navigation to clicks and form submissions, to capture a realistic user experience.
  • Performance Metrics Collection: Gather crucial data like load times, visual metrics, and more, for each step of your user journey.
  • Flexible Scripting Language: Write scripts in NodeJS, using familiar JavaScript syntax and robust libraries.

Getting Started

Dive into scripting with our tutorials, examples, and documentation for all commands.

If you are new to NodeJS and want to understand async/await you should read this post about async/await.

\ No newline at end of file diff --git a/docs/documentation/sitespeed.io/scripting/tutorial-05-Interact-Browser.html b/docs/documentation/sitespeed.io/scripting/tutorial-05-Interact-Browser.html index 1f3e7eabb..766250d76 100644 --- a/docs/documentation/sitespeed.io/scripting/tutorial-05-Interact-Browser.html +++ b/docs/documentation/sitespeed.io/scripting/tutorial-05-Interact-Browser.html @@ -7,7 +7,7 @@ export default async function (context, commands) { await commands.navigate('https://www.sitespeed.io'); } -

Cache

You can clear the browser cache from your script. The command works in Chrome, Edge and Firefox. Use it when you want to clear the browser cache between different URLs.

Clear cache and cookies

/**
+

Cache

You can clear the browser cache from your script. The command works in Chrome and Edge. Use it when you want to clear the browser cache between different URLs.

Clear cache and cookies

/**
  * @param {import('browsertime').BrowsertimeContext} context
  * @param {import('browsertime').BrowsertimeCommands} commands
  */