New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Node is either not clickable or not an HTMLElement #8627
Comments
I'm not sure why do you use an experimental API https://chromedevtools.github.io/devtools-protocol/tot/DOM/#method-getContentQuads to get the quads? It could be implemented same logic via |
Although I don't know the reason why Puppeteer uses the CDP implementation experimental methods are often created specifically for Puppeteer/DevTools (and remain experimental for years because experimental does not mean it does not work as expected or not supported, just that the API might change in the future). Puppeteer does not automatically wait for the element to become visible and that error is usually an indication that an element is not visible, and, thus, not clickable. Would you like to work on a PR that makes use of |
Thanks for the clarifications about the experimental API. Regarding the visibility, indeed the element is not visible in the viewport, but Anyway, I'll submit a PR and we can have a further discussion. |
@abozhilov The reason we don't use import puppeteer from "puppeteer";
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
const timeout = 30000;
page.setDefaultTimeout(timeout);
await page.goto("https://example.com");
const handle = await page.$x("//html/body/div/p[1]/text()");
console.log(await handle[0].clickablePoint());
await browser.close();
})(); See #8552 |
@jrandolf that's true, and what I thought is to perform a feature detection for |
The PR I mentioned doesn't fix the problem. It just fixes the incorrect semantics of the situation. In order to get this working, it seems you need to wait for the selector to appear before clicking. Have you tried this? |
Yes, I've tried. The element is in the DOM tree. As I mentioned the problem comes from getting element Quads and area calculation which returns 0. |
Then what I thinks make sense to do next is to attempt the CDP command and if it doesn't work, attempt |
Agreed! I'll try to submit a PR in the next couple of days. |
@OrKoN @jrandolf I've debugged the problem, and It does use the I managed to fix it, as I used Let me know if you agree to submit a PR which will replace the |
SGTM! |
This patch fixes page.#scrollIntoViewIfNeededso that it works with devtools protocol. Now it blocks the main thread and waits until the scrolling action finishes. Issues: puppeteer#8627, puppeteer#1805 BREAKING CHANGE: page.#scrollIntoViewIfNeeded throws erros which come from the internal implementation. - `Protocol error (DOM.scrollIntoViewIfNeeded): Node is detached from document` - `Protocol error (DOM.scrollIntoViewIfNeeded): Node does not have a layout object` Also now it does work with TextNode properly and does not throw an error.
This patch fixes page.#scrollIntoViewIfNeeded, so that it works with devtools protocol. Now it blocks the main thread and waits until the scrolling action finishes in Chrome. Fallbacks to the old implementation if `DOM.scrollIntoViewIfNeeded` is not supported for Firefox. Issues: puppeteer#8627, puppeteer#1805
This patch fixes page.#scrollIntoViewIfNeeded, so that it works with devtools protocol. Now it blocks the main thread and waits until the scrolling action finishes in Chrome. Fallbacks to the old implementation if `DOM.scrollIntoViewIfNeeded` is not supported for Firefox. Issues: puppeteer#8627, puppeteer#1805
This patch fixes page.#scrollIntoViewIfNeeded, so that it works with devtools protocol. Now it blocks the main thread and waits until the scrolling action finishes in Chrome. Fallbacks to the old implementation if `DOM.scrollIntoViewIfNeeded` is not supported for Firefox. Issues: puppeteer#8627, puppeteer#1805
This patch fixes page.#scrollIntoViewIfNeeded, so that it works with devtools protocol. Now it blocks the main thread and waits until the scrolling action finishes in Chrome. Fallbacks to the old implementation if `DOM.scrollIntoViewIfNeeded` is not supported for Firefox. Issues: puppeteer#8627, puppeteer#1805
I am still facing this issue :/ |
The issue is still there. |
please open a new issue with all details and a repro! |
The issue doesn't seem to be solved |
Bug description
Steps to reproduce the problem:
Given the following simple script:
It throws the following error:
That's due to area calculations which returns 0:
puppeteer/src/common/ElementHandle.ts
Line 1048 in 3735ef1
Puppeteer version
15.3.0
Node.js version
16.13.0
npm version
^15.3.0
What operating system are you seeing the problem on?
Linux
Relevant log output
No response
The text was updated successfully, but these errors were encountered: