Hi
I have below code and i want _driver to be public variable
IWebDriver _driver = new ChromeDriver();
static void Main(string[] args)
{
IWebDriver _driver = new ChromeDriver();
_driver.Navigate().GoToUrl("google.com");
_driver.FindElement(By.Name("q")).SendKeys("Learn Automation");
}
Thanks
Jayraj ChhayaPosted Apr 8, 2024, 9:11 AM
To make the
_drivervariable a public variable accessible throughout the class, you can declare it outside theMainmethod and mark it aspublic.