Open DanielStoica85 opened 1 month ago
@DanielStoica85 Unfortunately, I cannot reproduce the issue. page.goto()
always works for me, but the test is stuck on page.getByRole('link', { name: 'close' }).click()
because there is no "close" button on the page.
I'd recommend to use the debugging tools or record a trace and inspect it. We won't be able to help without reproducing the issue.
You can ignore all of the steps that come after page.goto()
, because the same thing will happen even if I change to a one step test like opening Google and that's it.
I will try what you suggested and get back to you.
@DanielStoica85 Unfortunately, I cannot reproduce the issue.
page.goto()
always works for me, but the test is stuck onpage.getByRole('link', { name: 'close' }).click()
because there is no "close" button on the page.I'd recommend to use the debugging tools or record a trace and inspect it. We won't be able to help without reproducing the issue.
I tried recording a trace and even opening the trace gives me a similar error:
npx playwright show-trace test-results/rate-ship-Rate-Ship-example-test--chromium/trace.zip
TimeoutError: Timeout 30000ms exceeded.
Later update: opening the trace only works from the report, but I can't see anything helpful. Can you please suggest what I should look for?
And one more update: even the test shown below fails for the same reason.
test('has title', async ({ page }) => {
await page.goto('https://playwright.dev/');
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Playwright/);
});
I noticed something else that might be helpful.
So like I said, navigation fails at first attempt, even when running the test by using the VS code extension. But after failing for the first time, if you rerun (without closing the browser) it will work on second attempt. And third, and so on... As long as you do not close the browser!
But then if you close the browser again and trigger a run, it will fail again at first attempt and you have to restart the process of retrying.
All of this happens when running with the VS Code extension. When running from the terminal, it always fails.
Debugging in UI mode is also impossible to do because it gets stuck like this:
@DanielStoica85 All the symptoms suggest that the browser is having troubles loading.
DEBUG=pw:browser npx playwright test
to see whether the browser has some interesting output.Thanks for getting back to me!
All I see in the trace viewer (network tab) is this:
As for your second suggestion, this is what I get:
pw:browser <launched> pid=29779 +7ms
pw:browser [pid=29779] <gracefully close start> +35s
pw:browser [pid=29779] <process did exit: exitCode=0, signal=null> +10s
pw:browser [pid=29779] starting temporary directories cleanup +0ms
pw:browser [pid=29779] finished temporary directories cleanup +13ms
pw:browser [pid=29779] <gracefully close end> +1ms
@DanielStoica85 Interesting! There are no browser errors, but the network request is stuck forever. Perhaps you've got a firewall or a corporate proxy that does not let the network requests through? Maybe you should add Playwright's Chromium binary to some list of exceptions?
One more suggestion is to try with the Google Chrome browser. Change your config like this:
...
{
name: 'chromium',
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
},
If a network proxy/firewall would be the problem, then it would never work. But like I explained above, after failing for the first time, if you rerun (without closing the browser) it will work on second attempt. And third, and so on... As long as you do not close the browser! Only when running from the terminal, it never works.
This was the result when running with Chrome browser:
pw:browser <launched> pid=71980 +6ms
pw:browser [pid=71980] <gracefully close start> +35s
pw:browser [pid=71980] <process did exit: exitCode=0, signal=null> +10s
pw:browser [pid=71980] starting temporary directories cleanup +1ms
pw:browser [pid=71980] finished temporary directories cleanup +14ms
pw:browser [pid=71980] <gracefully close end> +0ms
@DanielStoica85 Unfortunately, I am out of ideas at this point. I'll keep the issue open for some time, just in case someone would have an idea. If you gather more information that could be helpful, please comment here.
I ran into the same issue, it has something to do with the test name of test.info / annotation - try renaming the tests and removing all annotations.
same code that exhibited thisbehaviour, when moved to a different test with a different name (in same describe bracket) worked fine.
so something is buggy in there.
same code that exhibited thisbehaviour, when moved to a different test with a different name (in same describe bracket) worked fine.
so something is buggy in there.
For me it fails even if I use the example test that Playwright gives.
import { test, expect } from '@playwright/test';
test('has title', async ({ page }) => {
await page.goto('https://playwright.dev/');
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Playwright/);
});
@DanielStoica85 could you please give us the output of npx playwright --version
?
Is your machine corp-hosted / managed by some company policies? Or do you have special anti-virus software on your machine?
@DanielStoica85 could you please give us the output of
npx playwright --version
?Is your machine corp-hosted / managed by some company policies? Or do you have special anti-virus software on your machine?
Sure.
Version 1.44.1
As for the second question: the laptop is indeed managed by some company policies and there is company software installed on it (not just anti-virus). But if that would be the problem, wouldn't it always fail?
Ah, might also be worth mentioning that I tried another Playwright project created at my company and that one works. One main difference is that it uses a specific (older) version of Playwright: 1.33.0.
As for the second question: the laptop is indeed managed by some company policies and there is company software installed on it (not just anti-virus). But if that would be the problem, wouldn't it always fail?
Absolutely! But that might depend on what exactly is inferring with it. Your config uses Chromium - so ideally no enterprise policies apply there. If we are talking about Chrome policies, they usually only apply to Google Chrome and Microsoft Edge.
Ah, might also be worth mentioning that I tried another Playwright project created at my company and that one works. One main difference is that it uses a specific (older) version of Playwright: 1.33.0.
It might be worth trying the following:
Appreciate the digging - since we unfortunately run out of ideas here.
Hey @mxschmitt !
Thanks a lot for still trying to help, I know it almost seems like a hopeless situation, but I am not ready to give up just yet, haha. :)
Not sure what else to try.
Version
1.44.1
Steps to reproduce
I have a very basic new Playwright project setup and all I am doing for now is to try and run a test to open a page. I tried with different URLs and the result is always the same, instead of opening the test page, the browser gets stuck at about:blank.
Here's the config file:
Here is the test file:
Expected behavior
Bowser navigates to the test page url.
Actual behavior
Additional context
If I run it by using the VS Code extension, after a few retries it will start working.
If I run it in the terminal with
npx playwright test
, it never works.Also, the page I gave is just an example, I tried with other websites as well and the result is always the same.
Environment