lib

package
v1.0.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package lib registers HTML query functions for the Ferret HTML module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttributeGet

func AttributeGet(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

AttributeGet gets single or more attribute(s) of a given element. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target node. @param {String, repeated} attrNames - Attribute name(s). @return {Object} - Key-value pairs of attribute runtime.

func AttributeQuery

func AttributeQuery(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

AttributeQuery finds a single or more attribute(s) by a query selector. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target node. @param {String} selector - Query selector. @param {String, repeated} attrName - Attr name(s). @return {Object} - Key-value pairs of attribute runtime.

func AttributeRemove

func AttributeRemove(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

AttributeRemove removes single or more attribute(s) of a given element. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target node. @param {String, repeated} attrNames - Attribute name(s).

func AttributeSet

func AttributeSet(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

AttributeSet sets or updates a single or more attribute(s) of a given element. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target node. @param {String | Object} nameOrObj - Attribute name or an object representing a key-value pair of attributes. @param {String} value - If a second parameter is a string value, this parameter represent an attribute value.

func Blur

func Blur(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Blur calls blur on the element. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target node. @param {String} [selector] - CSS selector.

func Click

func Click(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Click dispatches a click event on a given element. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String | Int} [cssSelectorOrClicks] - CSS selector or count of clicks. @param {Int} [clicks=1] - Count of clicks.

func ClickAll

func ClickAll(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

ClickAll dispatches a click event on all matched elements. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - CSS selector. @param {Int} [clicks=1] - Optional count of clicks. @return {Boolean} - True if matched at least one element.

func CookieDel

func CookieDel(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

CookieDel deletes cookies from a given page. @param {HTMLPage} page - Target page. @param {HTTPCookie, repeated | String, repeated} cookiesOrNames - Cookie or cookie name to delete.

func CookieGet

func CookieGet(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

CookieGet gets a cookie from a given page by name. @param {HTMLPage} page - Target page. @param {String} name - Cookie or cookie name to delete. @return {HTTPCookie} - Cookie if found, otherwise None.

func CookieSet

func CookieSet(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

CookieSet sets cookies on a given page. @param {HTMLPage} page - Target page. @param {HTTPCookie, repeated} cookies - Target cookies.

func DocumentExists

func DocumentExists(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

DocumentExists returns a boolean value indicating whether a web page exists by a given URL. @param {String} url - Target url. @param {Object} [options] - Request options. @param {Object} [options.headers] - Request headers. @return {Boolean} - A boolean value indicating whether a web page exists by a given url.

func Download

func Download(_ context.Context, args ...runtime.Value) (runtime.Value, error)

Download downloads a resource from the given URL. @param {String} url - URL to download. @return {Binary} - A base64 encoded string in binary format.

func Element

func Element(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Element finds an element by a given CSS selector. Returns NONE if element not found. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - CSS selector. @return {HTMLElement} - A matched HTML element

func ElementExists

func ElementExists(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

ElementExists returns a boolean value indicating whether there is an element matched by selector. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - CSS selector. @return {Boolean} - A boolean value indicating whether there is an element matched by selector.

func Elements

func Elements(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Elements finds HTML elements by a given CSS selector. Returns an empty array if element not found. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - CSS selector. @return {HTMLElement[]} - An array of matched HTML elements.

func ElementsCount

func ElementsCount(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

ElementsCount returns the number of found HTML elements by a given CSS selector. Returns an empty array if element not found. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - CSS selector. @return {Int} - A number of matched HTML elements by a given CSS selector.

func Focus

func Focus(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Focus sets focus on the element. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} [selector] - CSS selector.

func Frames

func Frames(ctx context.Context, arg1, arg2, arg3 runtime.Value) (runtime.Value, error)

Frames finds HTML frames by a given property selector. Returns an empty array if frames not found. @param {HTMLPage} page - HTML page. @param {String} property - Property selector. @param {String} exp - Regular expression to match property value. @return {HTMLDocument[]} - Returns an array of found HTML frames.

func GetInnerHTML

func GetInnerHTML(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

GetInnerHTML returns the inner HTML string of a given or matched CSS selector element. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} [selector] - String of CSS selector. @return {String} - Inner HTML string if a matched element, otherwise empty string.

func GetInnerHTMLAll

func GetInnerHTMLAll(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

GetInnerHTMLAll returns an array of inner HTML strings of matched elements. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - String of CSS selector. @return {String[]} - An array of inner HTML strings if all matched elements, otherwise empty array.

func GetInnerText

func GetInnerText(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

GetInnerText returns the inner text string of a given or matched CSS selector element. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} [selector] - String of CSS selector. @return {String} - Inner text if a matched element, otherwise empty string.

func GetInnerTextAll

func GetInnerTextAll(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

GetInnerTextAll returns an array of inner text values for matched elements. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - String of CSS selector. @return {String[]} - An array of inner text if all matched elements, otherwise empty array.

func Hover

func Hover(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Hover fetches an element with a selector, scrolls it into view if needed, and hovers over its center. If there's no element matching selector, the method returns an error. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} [selector] - If document is passed, this param must represent an element selector.

func Input

func Input(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Input types a value into an underlying input element. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} valueOrSelector - CSS selector or a value. @param {String} value - Target value. @param {Int} [delay] - Target value. @return {Boolean} - Returns true if an element was found.

func InputClear

func InputClear(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

InputClear clears a value from an underlying input element. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} [selector] - CSS selector.

func IsHTMLDocument

func IsHTMLDocument(_ context.Context, arg runtime.Value) (runtime.Value, error)

IsHTMLDocument checks whether a value is an HTMLDocument value. @param {Any} value - Input value of arbitrary type. @return {Boolean} - Returns true if value is HTMLDocument, otherwise false.

func IsHTMLElement

func IsHTMLElement(_ context.Context, arg runtime.Value) (runtime.Value, error)

IsHTMLElement checks whether a value is an HTMLElement value. @param {Any} value - Input value of arbitrary type. @return {Boolean} - Returns true if value is HTMLElement, otherwise false.

func MouseMoveXY

func MouseMoveXY(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

MouseMoveXY moves the mouse by given coordinates. @param {HTMLDocument} document - HTML document. @param {Int|Float} x - X coordinate. @param {Int|Float} y - Y coordinate.

func Navigate(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Navigate navigates a given page to a new resource. The operation blocks the execution until the page gets loaded. Which means there is no need in WAIT_NAVIGATION function. @param {HTMLPage} page - Target page. @param {String} url - Target url to navigate. @param {Int} [timeout=5000] - Navigation timeout.

func NavigateBack(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

NavigateBack navigates a given page back within its navigation history. The operation blocks the execution until the page gets loaded. If the history is empty, the function returns FALSE. @param {HTMLPage} page - Target page. @param {Int} [entry=1] - An integer value indicating how many pages to skip. @param {Int} [timeout=5000] - Navigation timeout. @return {Boolean} - True if history exists and the operation succeeded, otherwise false.

func NavigateForward(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

NavigateForward navigates a given page forward within its navigation history. The operation blocks the execution until the page gets loaded. If the history is empty, the function returns FALSE. @param {HTMLPage} page - Target page. @param {Int} [entry=1] - An integer value indicating how many pages to skip. @param {Int} [timeout=5000] - Navigation timeout. @return {Boolean} - True if history exists and the operation succeeded, otherwise false.

func Open

func Open(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Open opens an HTML page by a given URL. By default, loads a page by http call - resulted page does not support any interactions. @param {Object} [params] - An object containing the following properties : @param {String} [params.driver] - Driver name to use. @param {Int} [params.timeout=60000] - Page load timeout. @param {String} [params.userAgent] - Custom user agent. @param {Boolean} [params.keepCookies=False] - Boolean value indicating whether to use cookies from previous sessions i.e. not to open a page in the Incognito mode. @param {Object[] | Object} [params.cookies] - Set of HTTP cookies to use during page loading. @param {String} params.cookies.*.name - Cookie name. @param {String} params.cookies.*.value - Cookie value. @param {String} params.cookies.*.path - Cookie path. @param {String} params.cookies.*.domain - Cookie domain. @param {Int} [params.cookies.*.maxAge] - Cookie max age. @param {String|DateTime} [params.cookies.*.expires] - Cookie expiration date time. @param {String} [params.cookies.*.sameSite] - Cookie cross-origin policy. @param {Boolean} [params.cookies.*.httpOnly=false] - Cookie cannot be accessed through client side script. @param {Boolean} [params.cookies.*.secure=false] - Cookie sent to the server only with an encrypted request over the HTTPS protocol. @param {Object} [params.headers] - Set of HTTP headers to use during page loading. @param {Object} [params.ignore] - Set of parameters to ignore some page functionality or behavior. @param {Object[]} [params.ignore.resources] - Collection of rules to ignore resources during page load and navigation. @param {String} [params.ignore.resources.*.url] - Resource url pattern. If set, requests for matching urls will be blocked. Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is backslash. Omitting is equivalent to "*". @param {String} [params.ignore.resources.*.type] - Resource type. If set, requests for matching resource types will be blocked. @param {Object[]} [params.ignore.statusCodes] - Collection of rules to ignore certain HTTP codes that can cause failures. @param {String} [params.ignore.statusCodes.*.url] - Url pattern. If set, codes for matching urls will be ignored. Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is backslash. Omitting is equivalent to "*". @param {Int} [params.ignore.statusCodes.*.code] - HTTP code to ignore. @param {Object} [params.viewport] - Viewport params. @param {Int} [params.viewport.height] - Viewport height. @param {Int} [params.viewport.width] - Viewport width. @param {Float} [params.viewport.scaleFactor] - Viewport scale factor. @param {Boolean} [params.viewport.mobile] - Value that indicates whether to emulate mobile device. @param {Boolean} [params.viewport.landscape] - Value that indicates whether to render a page in landscape position. @param {String} [params.charset] - (only HTTPDriver) Source charset content to convert UTF-8. @return {HTMLPage} - Loaded HTML page.

func OpenOrCastPage

func OpenOrCastPage(ctx context.Context, value runtime.Value) (drivers.HTMLPage, bool, error)

func PDF

func PDF(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

PDF prints a PDF of the current page. @param {HTMLPage | String}target - Target page or url. @param {Object} [params] - An object containing the following properties: @param {Bool} [params.landscape=False] - Paper orientation. @param {Bool} [params.displayHeaderFooter=False] - Display header and footer. @param {Bool} [params.printBackground=False] - Print background graphics. @param {Float} [params.scale=1] - Scale of the webpage rendering. @param {Float} [params.paperWidth=22] - Paper width in inches. @param {Float} [params.paperHeight=28] - Paper height in inches. @param {Float} [params.marginTo=1] - Top margin in inches. @param {Float} [params.marginBottom=1] - Bottom margin in inches. @param {Float} [params.marginLeft=1] - Left margin in inches. @param {Float} [params.marginRight=1] - Right margin in inches. @param {String} [params.pageRanges] - Paper ranges to print, e.g., '1-5, 8, 11-13'. @param {String} [params.headerTemplate] - HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: - `date`: formatted print date - `title`: document title - `url`: document location - `pageNumber`: current page number - `totalPages`: total pages in the document For example, `<span class=title></span>` would generate span containing the title. @param {String} [params.footerTemplate] - HTML template for the print footer. Should use the same format as the `headerTemplate`. @param {Bool} [params.preferCSSPageSize=False] - Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size. * @return {Binary} - PDF document in binary format.

func Pagination

func Pagination(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Pagination creates an iterator that goes through pages using a CSS selector. The iterator starts from the current page i.e. it does not change the page on 1st iteration. That allows you to keep scraping logic inside FOR loop. @param {HTMLPage} page - Target html page. @param {String} selector - CSS selector for a pagination on the page.

func Parse

func Parse(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Parse loads an HTML page from a given string or byte array. @param {String} html - HTML string to parse. @param {Object} [params] - An object containing the following properties: @param {String} [params.driver] - Name of a driver to parse with. @param {Boolean} [params.keepCookies=False] - Boolean value indicating whether to use cookies from previous sessions i.e. not to open a page in the Incognito mode. @param {HTTPCookies} [params.cookies] - Set of HTTP cookies to use during page loading. @param {HTTPHeaders} [params.headers] - Set of HTTP headers to use during page loading. @param {Object} [params.viewport] - Viewport params. @param {Int} [params.viewport.height] - Viewport height. @param {Int} [params.viewport.width] - Viewport width. @param {Float} [params.viewport.scaleFactor] - Viewport scale factor. @param {Boolean} [params.viewport.mobile] - Value that indicates whether to emulate mobile device. @param {Boolean} [params.viewport.landscape] - Value that indicates whether to render a page in landscape position. @return {HTMLPage} - Returns parsed and loaded HTML page.

func Press

func Press(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Press presses a keyboard key. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String | String[]} key - Target keyboard key(s). @param {Int} [presses=1] - Count of presses.

func PressSelector

func PressSelector(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

PressSelector presses a keyboard key. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - CSS selector. @param {String | String[]} key - Target keyboard key(s). @param {Int} [presses=1] - Count of presses.

func RegisterLib

func RegisterLib(ns runtime.Namespace)

func Screenshot

func Screenshot(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Screenshot takes a screenshot of a given page. @param {HTMLPage|String} target - Target page or url. @param {Object} [params] - An object containing the following properties : @param {Float | Int} [params.x=0] - X position of the viewport. @param {Float | Int} [params.y=0] - Y position of the viewport. @param {Float | Int} [params.width] - Width of the viewport. @param {Float | Int} [params.height] - Height of the viewport. @param {String} [params.format="jpeg"] - Either "jpeg" or "png". @param {Int} [params.quality=100] - Quality, in [0, 100], only for jpeg format. @return {Binary} - Screenshot in binary format.

func ScrollBottom

func ScrollBottom(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

ScrollBottom scrolls the document window to its bottom. @param {HTMLDocument} document - HTML document. @param {Int | Float} x - X coordinate. @param {Int | Float} y - Y coordinate. @param {Object} [params] - Scroll params. @param {String} [params.behavior="instant"] - Scroll behavior @param {String} [params.block="center"] - Scroll vertical alignment. @param {String} [params.inline="center"] - Scroll horizontal alignment.

func ScrollInto

func ScrollInto(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

ScrollInto scrolls an element into view. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - If document is passed, this param must represent an element selector. @param {Object} [params] - Scroll params. @param {String} [params.behavior="instant"] - Scroll behavior @param {String} [params.block="center"] - Scroll vertical alignment. @param {String} [params.inline="center"] - Scroll horizontal alignment.

func ScrollTop

func ScrollTop(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

ScrollTop scrolls the document window to its top. @param {HTMLDocument} document - HTML document. @param {Int | Float} x - X coordinate. @param {Int | Float} y - Y coordinate. @param {Object} [params] - Scroll params. @param {String} [params.behavior="instant"] - Scroll behavior @param {String} [params.block="center"] - Scroll vertical alignment. @param {String} [params.inline="center"] - Scroll horizontal alignment.

func ScrollXY

func ScrollXY(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

ScrollXY scrolls by given coordinates. @param {HTMLDocument} document - HTML document. @param {Int | Float} x - X coordinate. @param {Int | Float} y - Y coordinate. @param {Object} [params] - Scroll params. @param {String} [params.behavior="instant"] - Scroll behavior @param {String} [params.block="center"] - Scroll vertical alignment. @param {String} [params.inline="center"] - Scroll horizontal alignment.

func Select

func Select(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

Select selects a value from an underlying select element. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String | String[]} valueOrSelector - Selector or a an array of strings as a value. @param {String[]} value - Target value. Optional. @return {String[]} - Array of selected values.

func SetInnerHTML

func SetInnerHTML(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

SetInnerHTML sets the inner HTML string on a given or matched CSS selector element. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} htmlOrSelector - HTML or CSS selector. @param {String} html - String of inner HTML.

func SetInnerText

func SetInnerText(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

SetInnerText sets the inner text string on a given or matched CSS selector element. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} textOrCssSelector - String of CSS selector. @param {String} [text] - String of inner text.

func StyleGet

func StyleGet(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

StyleGet gets single or more style attribute value(s) of a given element. @param {HTMLElement} element - Target html element. @param {String, repeated} names - Style name(s). @return {Object} - Collection of key-value pairs of style runtime.

func StyleRemove

func StyleRemove(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

StyleRemove removes single or more style attribute value(s) of a given element. @param {HTMLElement} element - Target html element. @param {String, repeated} names - Style name(s).

func StyleSet

func StyleSet(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

StyleSet sets or updates a single or more style attribute value of a given element. @param {HTMLElement} element - Target html element. @param {String | Object} nameOrObj - Style name or an object representing a key-value pair of attributes. @param {String} value - If a second parameter is a string value, this parameter represent a style value.

func ValidatePageRanges

func ValidatePageRanges(pageRanges string) (bool, error)

func WaitAttribute

func WaitAttribute(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitAttribute waits until a target attribute value appears. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} attrNameOrSelector - String of an attr name or CSS selector. @param {String | Any} attrValueOrAttrName - Attr value or name. @param {Any | Int} [attrValueOrTimeout] - Attr value or a timeout. @param {Int} [timeout=5000] - Wait timeout.

func WaitAttributeAll

func WaitAttributeAll(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitAttributeAll waits for an attribute to appear on all matched elements with a given value. Stops the execution until the navigation ends or operation times out. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - String of CSS selector. @param {String} class - String of target CSS class. @param {Int} [timeout=5000] - Wait timeout.

func WaitClass

func WaitClass(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitClass waits for a class to appear on a given element. Stops the execution until the navigation ends or operation times out. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selectorOrClass - If document is passed, this param must represent an element selector. Otherwise target class. @param {String | Int} [classOrTimeout] - If document is passed, this param must represent target class name. Otherwise timeout. @param {Int} [timeout] - If document is passed, this param must represent timeout. Otherwise not passed.

func WaitClassAll

func WaitClassAll(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitClassAll waits for a class to appear on all matched elements. Stops the execution until the navigation ends or operation times out. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - String of CSS selector. @param {String} class - String of target CSS class. @param {Int} [timeout=5000] - Wait timeout.

func WaitElement

func WaitElement(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitElement waits for an element to appear in the DOM. Stops the execution until it finds an element or operation times out. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - Target element's selector. @param {Int} [timeout=5000] - Wait timeout.

func WaitNavigation

func WaitNavigation(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitNavigation waits for a given page to navigate to a new URL. Stops the execution until the navigation ends or operation times out. @param {HTMLPage} page - Target page. @param {Int} [timeout=5000] - Navigation timeout. @param {Object} [params=None] - Navigation parameters. @param {Int} [params.timeout=5000] - Navigation timeout. @param {String} [params.target] - Navigation target url. @param {HTMLDocument} [params.frame] - Navigation frame.

func WaitNoAttribute

func WaitNoAttribute(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitNoAttribute waits until a target attribute value disappears. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} attrNameOrSelector - String of an attr name or CSS selector. @param {String | Any} attrValueOrAttrName - Attr value or name. @param {Any | Int} [attrValueOrTimeout] - Attr value or wait timeout. @param {Int} [timeout=5000] - Wait timeout.

func WaitNoAttributeAll

func WaitNoAttributeAll(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitNoAttributeAll waits for an attribute to disappear on all matched elements by a given value. Stops the execution until the navigation ends or operation times out. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - String of CSS selector. @param {String} class - String of target CSS class. @param {Int} [timeout=5000] - Wait timeout.

func WaitNoClass

func WaitNoClass(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitNoClass waits for a class to disappear on a given element. Stops the execution until the navigation ends or operation times out. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selectorOrClass - If document is passed, this param must represent an element selector. Otherwise target class. @param {String | Int} [classOrTimeout] - If document is passed, this param must represent target class name. Otherwise timeout. @param {Int} [timeout] - If document is passed, this param must represent timeout. Otherwise not passed.

func WaitNoClassAll

func WaitNoClassAll(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitNoClassAll waits for a class to disappear on all matched elements. Stops the execution until the navigation ends or operation times out. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - String of CSS selector. @param {String} class - String of target CSS class. @param {Int} [timeout=5000] - Wait timeout.

func WaitNoElement

func WaitNoElement(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitNoElement waits for an element to disappear in the DOM. Stops the execution until it does not find an element or operation times out. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} selector - Target element's selector. @param {Int} [timeout=5000] - Wait timeout.

func WaitNoStyle

func WaitNoStyle(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitNoStyle waits until a target style value disappears. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} styleNameOrSelector - Style name or CSS selector. @param {String | Any} valueOrStyleName - Style value or name. @param {Any | Int} [valueOrTimeout] - Style value or wait timeout. @param {Int} [timeout=5000] - Wait timeout.

func WaitNoStyleAll

func WaitNoStyleAll(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitNoStyleAll waits until a target style value disappears on all matched elements with a given value. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} styleNameOrSelector - Style name or CSS selector. @param {String | Any} valueOrStyleName - Style value or name. @param {Any | Int} [valueOrTimeout] - Style value or wait timeout. @param {Int} [timeout=5000] - Timeout.

func WaitStyle

func WaitStyle(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitStyle waits until a target style value appears. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} styleNameOrSelector - Style name or CSS selector. @param {String | Any} valueOrStyleName - Style value or name. @param {Any | Int} [valueOrTimeout] - Style value or wait timeout. @param {Int} [timeout=5000] - Wait timeout.

func WaitStyleAll

func WaitStyleAll(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

WaitStyleAll waits until a target style value appears on all matched elements with a given value. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} styleNameOrSelector - Style name or CSS selector. @param {String | Any} valueOrStyleName - Style value or name. @param {Any | Int} [valueOrTimeout] - Style value or wait timeout. @param {Int} [timeout=5000] - Timeout.

func XPath

func XPath(ctx context.Context, arg1, arg2 runtime.Value) (runtime.Value, error)

XPath evaluates the XPath expression. @param {HTMLPage | HTMLDocument | HTMLElement} node - Target html node. @param {String} expression - XPath expression. @return {Any} - Returns result of a given XPath expression.

func XPathSelector

func XPathSelector(_ context.Context, expression runtime.Value) (runtime.Value, error)

XPathSelector returns a query selector of XPath kind. @param {String} expression - XPath expression. @return {Any} - Returns QuerySelector of XPath kind.

Types

type PageLoadParams

type PageLoadParams struct {
	Driver string `json:"driver"`
	drivers.Params
	Timeout time.Duration `json:"timeout"`
}

type Paging

type Paging struct {
	// contains filtered or unexported fields
}

func (*Paging) Iterate

func (p *Paging) Iterate(_ context.Context) (runtime.Iterator, error)

type PagingIterator

type PagingIterator struct {
	// contains filtered or unexported fields
}

func (*PagingIterator) Next

type ParseParams

type ParseParams struct {
	Driver string `json:"driver"`
	drivers.ParseParams
}

type WaitNavigationParams

type WaitNavigationParams struct {
	Frame     drivers.HTMLDocument `json:"frame"`
	TargetURL runtime.String       `json:"target"`
	Timeout   runtime.Int          `json:"timeout"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL