Rayrun
← Back to Discord Forum

trace

tomaszmyszkaposted in #help-playwright
Open in Discord

Hi. I'm struggling with the playwright and moon configuration. Is there an option to add tracking for remote connection? I am using the ConnectAsync option and I am unable to run tests with tracing. I get this error: Microsoft.Playwright.PlaywrightException : traceName: expected string, got undefined at Microsoft.Playwright.Transport.Connection.InnerSendMessageToServerAsync[T](String guid, String method, Dictionary2 dictionary, Boolean keepNulls) in /_/src/Playwright/Transport/Connection.cs:line 192 at Microsoft.Playwright.Transport.Connection.WrapApiCallAsync[T](Func1 action, Boolean isInternal) in //src/Playwright/Transport/Connection.cs:line 515 at Microsoft.Playwright.Transport.Channels.LocalUtilsChannel.TracingStartedAsync(String tracesDir, String traceName) in //src/Playwright/Transport/Channels/LocalUtilsChannel.cs:line 125 at Microsoft.Playwright.Core.Tracing.StartCollectingStacksAsync(String traceName) in //src/Playwright/Core/Tracing.cs:line 80 at Microsoft.Playwright.Core.Tracing.StartAsync(TracingStartOptions options) in //src/Playwright/Core/Tracing.cs:line 63

This thread is trying to answer question "How can one add tracking for remote connections when using the ConnectAsync option in Playwright?"

1 reply

`public async Task InitBrowserContext() { _playwright = await Playwright.CreateAsync(); if (IsRemote) try { _browser = await _playwright.Chromium.ConnectAsync( @"wss://moon.url/playwright/chrome/playwright-1.23.3?headless=false&enableVideo=true", new BrowserTypeConnectOptions { Timeout = TimeoutInMilliseconds }); } catch (Exception e) { Console.WriteLine(e); throw; } else _browser = await _playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions { Headless = IsHeadless, Timeout = TimeoutInMilliseconds });

_context = await _browser.NewContextAsync(new BrowserNewContextOptions
    {
        ScreenSize = new ScreenSize { Width = 1500, Height = 900 },
        ViewportSize = Resolution!.ViewportSize,
        IgnoreHTTPSErrors = true
    });

    if (IsTracing)
        await _context.Tracing.StartAsync(new TracingStartOptions
        {
            Screenshots = Screenshots,
            Snapshots = Snapshots
        });
}`
TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.