Code: Select all
public static IPlaywright playwright;
public static string baseUrl;
[BeforeTestRun]
public static async BeforetestRun()
{
playwright = await Playwright.CreateAsync();
baseUrl = Configuration["BaseURL"];
}
[BeforeScenario]
public async Task BeforeScenario()
{
var browser = await playwright.Chromium.LaunchAsync(new
BrowserTypeLaunchOptions {
Headless = false,
Args=new[] {"--disable-features"}
});
var context = await browser.NewContextAsync((new
BrowserNewContextOptions
{ IgnoreHTTPSErrors = false
});
var page = await context.NewPageAsync();
await page.GoToAsync(baseUrl);
}
Code: Select all
{
"BaseURL" = "my url"
}
Code: Select all
System.NullReferenceException: Object reference not set to an instance of an object.
Code: Select all
2025-03-18T13:32:46.7221827Z at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType)
2025-03-18T13:32:46.7222293Z at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireScenarioEvents(HookType bindingEvent)
2025-03-18T13:32:46.7222748Z at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnStepEnd()
2025-03-18T13:32:46.7223240Z at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance)
2025-03-18T13:32:46.7223819Z at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.Step(StepDefinitionKeyword stepDefinitionKeyword, String keyword, String text, String multilineTextArg, Table tableArg)
2025-03-18T13:32:46.7224379Z at TechTalk.SpecFlow.TestRunner.Given(String text, String multilineTextArg, Table tableArg, String keyword)