ElementHandle prevents DOM elements from garbage collection unless the
handle is disposed with Playwright.JSHandle.dispose/1. ElementHandles
are auto-disposed when their origin frame is navigated.
In most cases, you would want to use Playwright.Locator instead. You
should only use ElementHandle if you want to retain a handle to a
particular DOM node that you intend to pass into
Playwright.Page.evaluate/3 as an argument.
The difference between Playwright.Locator and ElementHandle is that
ElementHandle points to a particular element, while Playwright.Locator
captures the logic of how to retrieve an element.
In the example below, handle points to a particular DOM element on the
page. If that element changes text or is used by JavaScript to render an
entirely different component, handle still points to that very DOM element.
This can lead to unexpected behaviors.
With the Playwright.Locator, every time the locator is used, an
up-to-date DOM element is located in the page using the selector. So, in the
snippet below, the underlying DOM element is going to be located twice.
Clicks on the element, performing the following steps:
Wait for "actionability (guide)" checks on the element, unless force: true
option is set.
Scroll the element into view, if needed.
Use Playwright.Page.Mouse to click the center of the element, or the
specified option: position.
Wait for initiated navigations to either succeed or fail, unless
no_wait_after: true option is set.
If the element is detached from the DOM at any moment during the action,
this function raises.
When all steps combined have not finished during the specified :timeout,
this function raises a TimeoutError. Passing zero (0) for timeout
disables this.
Returns the node.textContent (all text within the element).
You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.