ElementHandle
elementHandle.click
Signature: elementHandle.click(options?)
options?
<object>delay?
<number> Time to wait between mousedown and mouseup in milliseconds.button?
<'left' | 'right' | 'middle'> Defaults to'left'
.force?
<boolean> Whether to bypass the actionability checks. Defaults tofalse
.clickCount?
<number> Count of button clicks, defaults to1
.position?
<object> Offset for the clickable point relative to the top-left corder of the border box.x
<number> x-offset for the clickable point relative to the top-left corder of the border box.y
<number> y-offset for the clickable point relative to the top-left corder of the border box.
timeout?
<number> Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the Page.setDefaultNavigationTimeout() or Page.setDefaultTimeout() methods.
Returns <Promise<void>> This method scrolls element into view if needed, and then uses Page.mouse to click in the center of the element. If the element is detached from DOM, the method throws an error.
elementHandle.dblclick
Signature: elementHandle.dblclick(options?)
options?
<object>delay?
<number> Time to wait between mousedown and mouseup in milliseconds.button?
<'left' | 'right' | 'middle'> Defaults to'left'
.force?
<boolean> Whether to bypass the actionability checks. Defaults tofalse
.position?
<object> Offset for the clickable point relative to the top-left corder of the border box.x
<number> x-offset for the clickable point relative to the top-left corder of the border box.y
<number> y-offset for the clickable point relative to the top-left corder of the border box.
timeout?
<number> Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the Page.setDefaultNavigationTimeout() or Page.setDefaultTimeout() methods.
Returns <Promise<void>> This method scrolls element into view if needed, and then uses Page.mouse to double click in the center of the element. If the element is detached from DOM, the method throws an error.
elementHandle.check
Signature: elementHandle.check(options?)
options?
<object>position?
<object> Offset for the clickable point relative to the top-left corder of the border box.x
<number> x-offset for the clickable point relative to the top-left corder of the border box.y
<number> y-offset for the clickable point relative to the top-left corder of the border box.timeout?
<number> Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the Page.setDefaultNavigationTimeout() or Page.setDefaultTimeout() methods.
This method checks the element by performing the following steps:
- Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this method returns immediately.
- Wait for actionability checks on the element, unless force option is set.
- Scroll the element into view if needed.
- Use page.mouse to click in the center of the element.
- Wait for initiated navigations to either succeed or fail.
- Ensure that the element is now checked. If not, this method throws.
elementHandle.uncheck
Signature: elementHandle.uncheck(options?)
options?
<object>force?
<boolean> Whether to bypass the actionability checks. Defaults to false.position?
<object> A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element. x <number> y <number>timeout?
<number> Maximum time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods.trial?
<boolean> When set, this method only performs the actionability checks and skips the action. Defaults to false. Useful to wait until the element is ready for the action without performing it.
This method checks the element by performing the following steps:
- Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked, this method returns immediately.
- Wait for actionability checks on the element, unless force option is set.
- Scroll the element into view if needed.
- Use page.mouse to click in the center of the element.
- Wait for initiated navigations to either succeed or fail, unless noWaitAfter option is set.
- Ensure that the element is now unchecked. If not, this method throws.
If the element is detached from the DOM at any moment during the action, this method throws.
When all steps combined have not finished during the specified timeout, this method throws a TimeoutError. Passing zero timeout disables this.
elementHandle.focus
Signature: elementHandle.focus(options?)
options?
<object>timeout?
<number> Maximum time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods.
Returns <Promise<void>>
Calls focus on the element.
elementHandle.hover
Signature: elementHandle.hover(options?)
options?
<object>force?
<boolean> Whether to bypass the actionability checks. Defaults tofalse
.modifiers?
<Array<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.position?
<object> A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.x
<number>y
<number>
timeout?
<number> Maximum time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods.trial?
<boolean> When set, this method only performs the actionability checks and skips the action. Defaults to false. Useful to wait until the element is ready for the action without performing it.
Returns <Promise<void>>
elementHandle.isVisible
Signature: elementHandle.isVisible(options?)
options?
<object>- timeout? <number> DEPRECATED This option is ignored.
elementHandle.isVisible(options?)
does not wait for the element to become visible and returns immediately.
- timeout? <number> DEPRECATED This option is ignored.
Returns <Promise<boolean>>
Returns whether the element is visible.
elementHandle.isCheck
Signature: elementHandle.isCheck(options?)
options?
<object>timeout?
<number> Maximum time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods.
Returns <Promise<boolean>>
Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
elementHandle.isHidden
Signature: elementHandle.isHidden(options?)
elementHandle.isDisabled
Signature: elementHandle.isDisabled(options?)
options?
<object>timeout?
<number> Maximum time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. Returns <Promise<boolean>>
Returns whether the element is disabled, the opposite of enabled.