Skip to main content

sdk.automation.clicktonavigate

Home > @matterway/sdk > Automation > clickToNavigate

Automation.clickToNavigate() function

Clicks on an element, and wait for navigation to complete.

Signature:

export declare function clickToNavigate(ctx: Context, selector: string): Promise<void>;

Parameters

ParameterTypeDescription
ctxContext
selectorstringSelector to click for navigation.

Returns:

Promise<void>

Remarks

Keep in mind, that this is fragile, because navigation ends before a website is fully ready; and that waiting for a selector is a much more robust way to detect when navigation is complete and the website is ready.

Example

await clickToNavigate(page, '.submit.button');