find
Finds a single element by its text content, optionally waiting for it to appear.
Return
The found Element, or null if no matching element is found within the timeout.
Parameters
The text to search for. Note: script contents are also considered text.
If true (default), returns the element with the most comparable string length. This helps when searching for common terms (e\.g\., "login") to get the most relevant element, such as a login button, instead of unrelated elements containing the text. If false, returns the first match found, which is faster.
Since the function often returns text nodes (children of elements like "span", "p", etc\.), this flag (default: true) returns the containing element instead of the text node itself. Set to false if you want the text node or for cases like elements with "placeholder=" property. If the found node is not a text node but a regular element, the flag is ignored and the element is returned.
The maximum time in milliseconds to wait for the element to appear before raising a timeout exception.