Closed viraxslot closed 3 years ago
It is hard to say what's wrong. Looking at the logs, there is a dialog <div tabindex="-1" class="md-dialog-container ng-scop…>…</div>
that probably overlays the target button you are trying to click.
I'd suggest to try/catch the failing click call and capture screenshot when it fails, to see what's happening in the page. This way we'll be able to tell whether that's actually the dialog overlaying the button, or something else. Could you please do that? Otherwise, I don't know how to help without a working repro, or at least a page url.
try {
await page.click('.button-enter');
} catch (e) {
console.log(e);
await page.screenshot({ path: 'click-failure.png' });
}
@dgozman you're absolutely right, it's overlay :( It's interesting why in headless mode browser's version is parsed like 0, I'll check that:
Is it possible not to log any try to click the button? Because such output doesn't really help when using mocha for example.
It's interesting why in headless mode browser's version is parsed like 0, I'll check that:
That's probably because headless version has a different user agent: HeadlessChrome/86
instead of Chrome/86
.
Is it possible not to log any try to click the button? Because such output doesn't really help when using mocha for example.
I didn't understand this question. Are you asking about a particular line in the logs that you found distracting? Could you please rephrase this with more details?
Could you please rephrase this with more details?
@dgozman yes, sorry. In headless.log file you can see a lot of messages how playwright tries to click the button. I suppose it writes, waits a bit, tries to click again and writes again. I have 20 seconds timeout and when my test fails I have all these messages written to my console (4k lines). So my question is: is it possible to write more "user friendly" log? :)
Something like this:
retrying click action
waiting for element to be visible, enabled and not moving
element is visible, enabled and does not move
scrolling into view if needed
done scrolling
checking that element receives pointer events at (932.48,215.48)
<div tabindex="-1" class="md-dialog-container ng-scop…>…</div> intercepts pointer events
Tries 1, 2, 3....
So it'll be only one "retrying click action" message with amount of tries.
@viraxslot This makes sense, thanks for the explanation. I will look into this.
With #4001, there should be fewer logs now. Let me close this, but if you still find that we have too much logs, please reopen/comment.
Context:
Code Snippet
Describe the bug My test is really simple: I fill email and password, click submit button and wait for the new page's selector and correct URL.
Form:
Button:
In headful Chromium everything works fine, log: headful.log
In headless Chromium playwright tries to click button with no result and fails by timeout: headless.log
Chromium options: