Microsoft.Playwright.PlaywrightException:Connection closed (connection disposed)| Playwright c# POM page object model

girish joshi 1 Reputation point

public async Task Test2()
//IPage page=null;
LoginPage lpage=new LoginPage();
IPage page=await IPage .loginToApllication("john","admin","<<applicationLink>>",false);
await cMgmt.fillCalendarDetails();

public class LoginPage

public async Task <Ipage> loginToApllication(username,pwd,URL,bHeadLess);
using var playwright=await playwright.createAsync();
BrowserTypeLaunchOptions launchoptions=new BrowserTypeLaunchOptions ();
launchoptions.HeadLess = bHeadLess;

await using var browser=await.playwright.Chromium.launchAsync(launchoptions);
var page=await browser.NewPageAsync();

await page.GotoAsync(URL);
await page.TypeAsync("#loginid",username);
await page.TypeAsync("#pwd",pwd);
await page.clickAsync("#submit);
return page;

Getting below error when i am trying to return page created in loginToApllication()
error - Microsoft.Playwright.PlaywrightException:Connection closed (connection disposed)

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,503 questions
{count} votes