I have a class called Driver
and I'm trying to five its attributes to another class, so I can use it for the Locators, but it is giving me this error on the driver from the locator.
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.UI;
namespace AutomationTest
{
public class BaseLocator
{
public static RemoteWebDriver driver;
public static WebDriverWait wait;
public IWebElement SearchBox => driver.FindElementByCssSelector("#twotabsearchtextbox");
public IWebElement SearchButton => driver.FindElementByCssSelector("span#nav-search-submit-text + input");
public IWebElement GoToShoppingButton => driver.FindElementByCssSelector("#nav-cart-count");
public IWebElement GoToYourAmazonButton => driver.FindElementByCssSelector("a#nav-your-amazon");
}
}
and I have Driver
set up as:
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Remote;
namespace AutomationTest
{
public class Driver
{
public RemoteWebDriver SetUp()
{
RemoteWebDriver driver = new ChromeDriver();
return driver;
}
}
}