public static void InitDriverManager(DriverProperty defaultProperty) { driverList = new Dictionary <string, IWebDriver>(); propertyList = new Dictionary <string, DriverProperty>(); if (defaultProperty != null) { defaultKey = defaultProperty.DriverType.ToDescription() + "-1"; defaultDriverProperty = defaultProperty; } }
public static void AddNewDriver(DriverProperty property) { ParameterValidator.ValidateNotNull(property, "Driver Property"); string key; // Get target driver from factory IWebDriver webDriver = WebDriverFactory.GetWebDriver(property); //webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); key = property.DriverType.ToDescription() + "-" + GetNextPlatformNumber(property.DriverType.ToDescription()); driverList.Add(key, webDriver); propertyList.Add(key, property); currentKey = key; }
public static IWebDriver GetWebDriver(DriverProperty driverProperty) { if (driverProperty != null) { string methodName = "CreateDriver"; if (!string.IsNullOrEmpty(driverProperty.RemoteUrl)) { methodName = "CreateRemoteDriver"; } Type browserType = Type.GetType($"Framework.Test.Common.DriverWrapper.Browser.{driverProperty.DriverType.ToString()}WebDriver"); object obj = Activator.CreateInstance(browserType); return((IWebDriver)browserType.InvokeMember(methodName, BindingFlags.InvokeMethod, null, obj, new object[] { driverProperty })); } return(null); }
public abstract IWebDriver CreateRemoteDriver(DriverProperty driverProperty);