-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
How to debug the issue "locator.click: Target closed" #13090
Comments
Thanks for your report! You can enable tracing and open the trace from a failed test to see what's going on: https://playwright.dev/docs/trace-viewer |
Closing per-above advice, but if that doesn't help, please re-open! |
i have the same issue, anybody have an idea? |
I my case the problem was that dispose method was called before clicking on item. And dispose was wrongly called because instead of "async Task" - "async void" was used. |
Question: does the test timeout also include the retries as well? It would explain a lot of these target closed messages, I can see some of these screenshots show a retry in the test's output dir. |
Getting the |
How about this patch?
|
Can we re-open this issue? I'm experiencing this as well with Github Actions but locally, it's working fine. |
Same. I don't know if the problem is with my setup or GH Actions though |
We're also encountering this error seemingly randomly in our e2e tests on Github CI. But when it happens, it's consistent through retries and the test will fail no mater how many retries we set.
In this instance, webkit and firefox tests all passed on the first try, but the chromium tests failed 3 times in a row, with this specific error. Our tests are taking very long though, and since tests on CI only have 1 worker, it could indeed be the symptom of the timeout, and not the cause of it, as it was suggested. |
Never mind, I don't think it's the timeout. |
I am experiencing the same issue with tests that were running initially. Everything works on my local environment but fails on GitHub CI |
👍 For me too. Stepping through the test results in success every time locally(app doesn't have CI yet), but fails intermittently on test run. |
Dangit, it was an |
By how much did you increase the timeout?
On Thu, 15 Dec 2022 at 23:26, Tom Holland ***@***.***> wrote:
Dangit, it was an ID10T error! I just needed to increase the global
timeout. lol
—
Reply to this email directly, view it on GitHub
<#13090 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK4QM7CSHWQ2CQNIOQYWZWDWNN5ITANCNFSM5RWJFIOA>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
null
|
The spec runs I'm working on usually take 35-50s, so I set it to 60s. Been fine ever since. |
I still facing this error on my Github Action CI. It's working well on my localhost. So do we have any solution for this? |
@huykon
|
I've been working on an assignment so very new to playwright but I have the same issue. On my local, Chrome, webkit and Firefox all pass consistently (sometimes a security error may pop up on Firefox causing issue but 9% of the time passes) however when I push to my repo, all the firefox tests fail on the same part when trying to signup. |
We're also running into this issue. Awaiting a fix, thanks. For now we will be using cypress tests. |
Did you use trace viewer? That fixed the issue for me (was a timing issue). Trace is really good debugging tool, thanks. |
For me I think it was because of id's not matching between the generator and the test browser. |
Same issue here, as many have reported. On local it works fine but on GitHub Actions constantly fails. |
Adding a +1 here. Tests run fine locally, but fail in GitHub CI. I have no idea why, but when I add |
for me its locally failing too :( |
Guys, I've solved the same issue on my side: Wrong ❌ : This error caused the backend request instead of mocking my data, => I received data from the backend => and the button I wanted to click was disabled ( backend response ) => triggering some "Target closed" fails. ALWAYS run your tests via I don't know why locally it was working and on Github actions it was not, but if your tests are written well, they'll work everywhere. I hope I'll help someone, if not just get some patience and try to debug tests one time per other. |
In my case, the reason was that I didn't include the
|
I was seeing this on a few tests in GitHub Actions, while locally I could not reproduce this. The error looks like this:
The docs indicate that this might have something to do with how Playwright is too fast for the page, but this test is very long and the page has already loaded, and in fact actions have already been taken on these form elements several times. My best guess is that there's some kind of rendering issue or underlying problem with the form components we are using that tricks Playwright into either losing focus or not waiting long enough to be able to find the input element by the placeholder, I'm not 100% sure. Adding |
Why you guys don't use the |
I have await in place and I still get the error.
|
I also have this problem from time to time, on my local machine with chrome (not tried it somewhere else yet). The locator works (checked in trace view) and also explicit |
Incrementing the timeout on the playwright.config.ts worked for me. |
Had this problem when running playwright in docker on mac. For some reason problem resolved after docker restart (actually, I'm using Colima, so I did |
Same issue. Works locally (both Chromium and Webkit). In GH, Chromium works, but Webkit is failing constantly |
same issue, causing random flakiness. |
Solved it now with a general time out. Are there any updates on a "best practice" fix?? |
I also get this issue randomly in Azure pipeline, locally always works ok. I increased the timeout but still randomly gets this issue. It even can be that I run the same pipeline (code is the same) and first time it is ok and the next time it fails with this issue. |
@claucol I've been tracking something like this at my workplace and have been working on upgrading playwright from 1.23 to 1.37. Seems like folks who upgraded to Sonoma running webkit 17.1 run into target closed issues with older versions of playwright. My hope is that the upgrade helps with this situation. |
thank you for your answer @williamlabrum, however I'm already using Playwright 1.37.1 so I think that's not the cause |
Maybe this is helpful for some of you: When I had the issue, I was using a locator to find a button. Verifiying that the button was visible and enabled both worked, but clicking afterwards does not ("target closed"). In the trace view the locator also selected and highlighted correctly the button. After some debugging I found out, that in my application the button actually was replaced quickly by another one (different labels) during the test. Think of something like: during loading of data the button shows "please wait" and later it is replaced by "edit data". Now in my case I was trying to click on the"old" button ("please wait"), that does not exists anymore in the UI. My assumption in this case was, that playwright in this case (a) would show the "new" button in the trace view and (b) would make my test fail when doing the visible and enabled checks (as the button does not exists anymore). I tried timeout and sleeps in my test, so that I was sure that the new button was displayed, expecting my tests to fail when using the "old" locator for checkig the visibility of the old not existing button, but tests still only failed when trying to click that button. |
I have the same issue. Increase the timeout works, but that doesn't make any sense. My button is here and shows in the trace viewer, but somehow Playwright cannot click it. Very weird. |
For future users running into it: we recommend filing a new issue with a minimal reproduction so we can help you better, since this error can have many different causes. |
I have the bellow error. I can NOT reproduce it in my local environment. So how can I debug it? I have no idea.
I have a lot of other cases and they all can work except for this one. Need your help, thanks.
The text was updated successfully, but these errors were encountered: