-
Notifications
You must be signed in to change notification settings - Fork 293
Open
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?
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
Labels
No labels