You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But now since the API signatures have changed ($x(expression) and click(this, options)), the above usage ends up with the following tsc compilation error:
error TS2684: The 'this' context of type 'ElementHandle<Node>' is not assignable to method's 'this' of type 'ElementHandle<Element>'.
7 await handles[0].click();
~~~~~~~~~~
How shall I transit from using Element to using Node?
The text was updated successfully, but these errors were encountered:
Qlub53
changed the title
What is the right way of clicking an ElementHandle<Node> since v15.3.1
What is the right way of clicking an ElementHandle<Node> since v15.3.1
Aug 28, 2022
I think this is expected since XPath selectors might return not only elements. Try the following: await (handles[0] as ElementHandle<Element>).click(); if the selector is guaranteed to contain an element.
@jrandolf What do you think? Can we do something to be type-correct but also make it easier for xpath users? e.g., maybe infer the type from the selector similar to what we do for CSS selectors?
I used to use page.$x(expression) and elementHandle.click([options]) with puppeteer v13.4 just fine.
But now since the API signatures have changed ($x(expression) and click(this, options)), the above usage ends up with the following
tsc
compilation error:How shall I transit from using
Element
to usingNode
?Originally posted by @Qlub53 in #8552 (comment)
The text was updated successfully, but these errors were encountered: