The method runs element.querySelector within the page. If no element matches the selector, the return value resolve to null.
A selector to query element for
The method runs element.querySelectorAll within the page. If no elements match the selector, the return value resolve to [].
A selector to query element for
This method runs Array.from(document.querySelectorAll(selector))
within the context and passes it as the
first argument to pageFunction
.
If pageFunction
returns a Promise, then $$eval
would wait for the promise to resolve and return its value.
A selector to query for
Function to be evaluated in browser context
Promise which resolves to the return value of pageFunction
This method runs Array.from(document.querySelectorAll(selector))
within the context and passes it as the
first argument to pageFunction
.
If pageFunction
returns a Promise, then $$eval
would wait for the promise to resolve and return its value.
A selector to query for
Function to be evaluated in browser context
First argument to pass to pageFunction
Promise which resolves to the return value of pageFunction
This method runs Array.from(document.querySelectorAll(selector))
within the context and passes it as the
first argument to pageFunction
.
If pageFunction
returns a Promise, then $$eval
would wait for the promise to resolve and return its value.
A selector to query for
Function to be evaluated in browser context
First argument to pass to pageFunction
Second argument to pass to pageFunction
Promise which resolves to the return value of pageFunction
This method runs Array.from(document.querySelectorAll(selector))
within the context and passes it as the
first argument to pageFunction
.
If pageFunction
returns a Promise, then $$eval
would wait for the promise to resolve and return its value.
A selector to query for
Function to be evaluated in browser context
First argument to pass to pageFunction
Second argument to pass to pageFunction
Third argument to pass to pageFunction
Promise which resolves to the return value of pageFunction
This method runs Array.from(document.querySelectorAll(selector))
within the context and passes it as the
first argument to pageFunction
.
If pageFunction
returns a Promise, then $$eval
would wait for the promise to resolve and return its value.
A selector to query for
Function to be evaluated in browser context
Arguments to pass to pageFunction
Promise which resolves to the return value of pageFunction
This method runs document.querySelector
within the context and passes it as the first argument to pageFunction
.
If there's no element matching selector
, the method throws an error.
If pageFunction
returns a Promise, then $eval
would wait for the promise to resolve and return its value.
A selector to query for
Function to be evaluated in browser context
Promise which resolves to the return value of pageFunction
This method runs document.querySelector
within the context and passes it as the first argument to pageFunction
.
If there's no element matching selector
, the method throws an error.
If pageFunction
returns a Promise, then $eval
would wait for the promise to resolve and return its value.
A selector to query for
Function to be evaluated in browser context
First argument to pass to pageFunction
Promise which resolves to the return value of pageFunction
This method runs document.querySelector
within the context and passes it as the first argument to pageFunction
.
If there's no element matching selector
, the method throws an error.
If pageFunction
returns a Promise, then $eval
would wait for the promise to resolve and return its value.
A selector to query for
Function to be evaluated in browser context
First argument to pass to pageFunction
Second argument to pass to pageFunction
Promise which resolves to the return value of pageFunction
This method runs document.querySelector
within the context and passes it as the first argument to pageFunction
.
If there's no element matching selector
, the method throws an error.
If pageFunction
returns a Promise, then $eval
would wait for the promise to resolve and return its value.
A selector to query for
Function to be evaluated in browser context
First argument to pass to pageFunction
Second argument to pass to pageFunction
Third argument to pass to pageFunction
Promise which resolves to the return value of pageFunction
This method runs document.querySelector
within the context and passes it as the first argument to pageFunction
.
If there's no element matching selector
, the method throws an error.
If pageFunction
returns a Promise, then $eval
would wait for the promise to resolve and return its value.
A selector to query for
Function to be evaluated in browser context
Arguments to pass to pageFunction
Promise which resolves to the return value of pageFunction
Returns a ElementHandle
This method returns the value resolve to the bounding box of the element (relative to the main frame), or null if the element is not visible.
This method returns boxes of the element, or null if the element is not visible. Boxes are represented as an array of points; each Point is an object {x, y}. Box points are sorted clock-wise.
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.
Specifies the options.
Resolves to the content frame for element handles referencing iframe nodes, or null otherwise.
Stops referencing the element handle.
Evaluates a function in the browser context. If the function, passed to the frame.evaluate, returns a Promise, then frame.evaluate would wait for the promise to resolve and return its value. If the function passed into frame.evaluate returns a non-Serializable value, then frame.evaluate resolves to undefined.
Arguments to pass to fn
The only difference between evaluate
and evaluateHandle
is that evaluateHandle
returns in-page object (JSHandle
).
If the function, passed to the evaluateHandle
, returns a Promise
, then evaluateHandle
would wait for the
promise to resolve and return its value.
The TypeScript definitions assume that evaluateHandle
returns a JSHandle
, but if you know it's going to return an
ElementHandle
, pass it as the generic argument:
a function that is run within the page
arguments to be passed to the pageFunction
Gets the execution context.
Calls focus on the element.
Returns a map with property names as keys and JSHandle instances for the property values.
Fetches a single property from the objectHandle.
The property to get.
This method scrolls element into view if needed, and then uses page.mouse to hover over the center of the element. If the element is detached from DOM, the method throws an error.
Resolves to true if the element is visible in the current viewport.
Returns a JSON representation of the object. The JSON is generated by running JSON.stringify on the object in page and consequent JSON.parse in puppeteer.
Focuses the element, and then uses keyboard.down and keyboard.up.
Name of key to press, such as ArrowLeft. See USKeyboardLayout for a list of all key names.
The text and delay options.
This method scrolls element into view if needed, and then uses page.screenshot to take a screenshot of the element. If the element is detached from DOM, the method throws an error.
Same options as in page.screenshot.
Triggers a change and input event once all the provided options have been selected. If there's no
Values of options to select. If the
An array of option values that have been successfully selected.
This method scrolls element into view if needed, and then uses touchscreen.tap to tap in the center of the element. If the element is detached from DOM, the method throws an error.
Focuses the element, and then sends a keydown, keypress/input, and keyup event for each character in the text.
A text to type into a focused element.
The typing options.
This method expects elementHandle to point to an input element.
Sets the value of the file input these paths. If some of the filePaths are relative paths, then they are resolved relative to current working directory.
Generated using TypeDoc
Represents an in-page DOM element. ElementHandles can be created with the page.$ method.