have seen that for IWebDriver driver it can be declared globally .. and therefore it can be used anywhere down the program..for eg.
namespace TestProject1.BaseClass
{
public class BaseTest
{
public IWebDriver driver;
[OneTimeSetUp]
public void Test1()
{
driver = new ChromeDriver();
driver.Manage().Window.Maximize();
driver.Navigate().GoToUrl("https://www.google.com");
}
[OneTimeTearDown]
public void Test2()
{
driver.Quit();
}
}
}
but I'm not able to declare "IWebElement ele" the same way..that is as a global variable...
i see im having an error when i do that
" Non-nullable variable must contain a non-null value when exiting constructor. Consider declaring it as nullable"
how can i rectify this?