microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.83k stars 3.66k forks source link

[BUG] Tests did not work with Chromium #16639

Closed jaro0197 closed 2 years ago

jaro0197 commented 2 years ago

Context:

Code Snippet

public class Tests
{

    public IPage Page { get; private set; } = null!;

    [Test]
    public async Task HomepageHasPlaywrightInTitleAndGetStartedLinkLinkingtoTheIntroPage()
    {
        var playwright =Playwright.CreateAsync().Result;
        var browser = playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions
        {
            Headless = false
        }).Result;

        Page = await browser.NewPageAsync().ConfigureAwait(true);

        await Page.GotoAsync("https://playwright.dev");

    }

}

Bug description

The tests are stuck with Chromium open with no further actions. and i get following error (running with set DEBUG=pw:browser,pw:protocol):

2022-08-18T12:54:07.314Z pw:browser <launching> C:\Users\jkmak\AppData\Local\ms-playwright\chromium-1019\chrome-win\chrome.exe --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --no-sandbox --user-data-dir=C:\Users\jkmak\AppData\Local\Temp\playwright_chromiumdev_profile-cpOQpD --remote-debugging-pipe --no-startup-window
2022-08-18T12:54:07.334Z pw:browser <launched> pid=6552
2022-08-18T12:54:07.337Z pw:protocol SEND Ôľ║ {"id":1,"method":"Browser.getVersion"}
2022-08-18T12:54:12.650Z pw:browser [pid=6552][err] [6552:32480:0818/145412.649:ERROR:device_event_log_impl.cc(214)] [14:54:12.649] USB: usb_device_handle_win.cc:1048 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
2022-08-18T12:54:12.650Z pw:browser [pid=6552][err] [6552:32480:0818/145412.650:ERROR:device_event_log_impl.cc(214)] [14:54:12.650] USB: usb_device_handle_win.cc:1048 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)

Running with Firefox browser the test is working fine. I found similiar issue, but in this case the firefox browser stuck: https://github.com/microsoft/playwright-java/issues/1001 I also tried other version of Chrome (beta, developer) and Playwright but outcome was the same.

When the browser is opened I get also this message: image but idk if this can be related with my issue. On basic/beta chrome this message is not appear and test also is failing.

aslushnikov commented 2 years ago

@jaro0197 Can you try launching without --disable-extensions default flag that we use?

using Microsoft.Playwright;
using System.Threading.Tasks;

class Program
{
    public static async Task Main()
    {
        using var playwright = await Playwright.CreateAsync();
        await using var browser = await playwright.Chromium.LaunchAsync(new() { IgnoreDefaultArgs = new[] { "--disable-extensions" });
        var page = await browser.NewPageAsync();
        await page.GotoAsync("https://playwright.dev/dotnet");
        await page.ScreenshotAsync(new PageScreenshotOptions { Path = "screenshot.png" });
    }
}
aslushnikov commented 2 years ago

Since my triaging rotation is over, I'll close this as per above.

Please feel free to file a new issue if you think we still can be helpful to you!