Skip to content

[Question]: about: net::ERR_CONNECTION_REFUSED at https://localhost:7119/ #3267

@simix-alessandrokantousian

Description

Context

  • Playwright Version: 1.57.0
  • Operating System: Windows 11
  • .NET 10
  • Browser: Chromium, Firefox

Description

I'd like to understand why I get this error when I try to run Playwright, but when I have two Visual Studio windows open—one running the project and the other running Playwright—it works. Do I need to configure something in the project to be able to run the test with only one Visual Studio window open? Or is there some configuration that makes the project run before Playwright run?

Image

Code Snippet

public class Test1 {

    [TestMethod]
    public async Task Access_Panel_Page()
    {
        var playwright = await Microsoft.Playwright.Playwright.CreateAsync();
        var browser = await playwright.Chromium.LaunchAsync(new() {
            Headless = false,
            SlowMo = 50
        });

        var context = await browser.NewContextAsync(new BrowserNewContextOptions {
            ViewportSize = new ViewportSize { Width = 1920, Height = 1080 },
            ScreenSize = new ScreenSize { Width = 1920, Height = 1080 }
        });
                //Act
        var page = await context.NewPageAsync();
        await page.GotoAsync($"https://localhost:7119");
        await page.WaitForLoadStateAsync(LoadState.NetworkIdle);


        var element = await page.QuerySelectorAsync("h1");
        Assert.IsNotNull(element, "O elemento <h1> não foi encontrado.");

        var textContent = await element.InnerTextAsync();
        Assert.AreEqual("HelloWorld", textContent.Trim());
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions