public WebDriver(DriverTypes driverType, string rootUrl, string appPath = "/") { DriverType = driverType; RootUrl = rootUrl; AppPath = appPath; SetupDriver(); }
private IWebDriver GetDriver(DriverTypes type) { IWebDriver driver = null; switch (type) { case DriverTypes.IE: driver = new InternetExplorerDriver( new InternetExplorerOptions { UnexpectedAlertBehavior = InternetExplorerUnexpectedAlertBehavior.Default, EnableNativeEvents = true, //ForceCreateProcessApi = true, //BrowserCommandLineArguments = "-private", EnsureCleanSession = true }); driver = new NgWebDriver(driver); break; case DriverTypes.Chrome: ChromeOptions options = new ChromeOptions(); options.AddArgument("--disable-plugins"); driver = new ChromeDriver(options); driver = new NgWebDriver(driver); break; } ((NgWebDriver)driver).IgnoreSynchronization = true; return(driver); }
public static void Init() { SystemHelper sh = new SystemHelper(); foreach (var dtk in _apiMap.Values.Select(t => $"{t.Name} Drivers")) { tlog.LogMessage("DriverLoader", $"Loading/Creating node for Ascom {dtk}"); DriverTypeNode dn = sh.SubNode <DriverTypeNode>(sh.Ascom.ProfileNodeId, $"{dtk}", true); if (dn == null) { tlog.LogMessage("DriverLoader", $"Failed to access Ascom {dtk}"); throw new DriverException("Driver loader initialization failed"); } tlog.LogMessage("DriverLoader", $"Got handle to Ascom {dtk} [{dn.ProfileNodeId}]"); } tlog.LogMessage("AscomDriverLoader", $"Driver Root: {DriverRoot}"); tlog.LogMessage("AscomDriverLoader", $"Loading assemblies..."); LoadAssemblies(); tlog.LogMessage("AscomDriverLoader", $"{Assemblies.Count()} assemblies loaded"); foreach (var a in Assemblies) { Version aver = a?.GetName().Version; tlog.LogMessage("AscomDriverLoader", $"\t {a.FullName} v{aver.Major}.{aver.Minor}.{aver.MajorRevision}.{aver.MinorRevision}"); } tlog.LogMessage("AscomDriverLoader", $"Registering drivers..."); RegisterDrivers(); tlog.LogMessage("AscomDriverLoader", $"{DriverTypes.Count()} drivers loaded"); foreach (var dt in DriverTypes) { tlog.LogMessage("AscomDriverLoader", $"\t {dt.FullName}"); } }
public static IWebDriver GetDriver(DriverTypes driver) { Dictionary <DriverTypes, IDriver> drivers = new Dictionary <DriverTypes, IDriver>(); drivers.Add(DriverTypes.CHROME, new Chrome()); drivers.Add(DriverTypes.FIREFOX, new Firefox()); return(drivers[driver].InitDriver()); }
public SeleniumTestsForAppulate(DriverTypes type) { _driver = DriverInitHelper.CreateDriver(type); _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); _driver.Manage().Window.Maximize(); _mainSteps = new MainSteps(_driver); _uploadImageSteps = new UploadImageSteps(_driver); _fillingNameSteps = new FillingNameSteps(_driver); }
public static void Initialize(DriverTypes driverType) { //SessConfiguration.AppHost = BaseUrl; SessConfiguration.Browser = browsersToBeTested[driverType]; SessConfiguration.Timeout = TimeSpan.FromSeconds(Constants.MaxTimeOut); SessConfiguration.RetryInterval = TimeSpan.FromSeconds(0.5); Instance = new BrowserSession(SessConfiguration); Instance.MaximiseWindow(); //((RemoteWebDriver)Instance.Native).Manage().Window.Maximize(); }
public void Init(DriverTypes driver, ScreenSizes windowSize) { Driver = GetDriver(driver); Driver.Manage().Window.Size = new System.Drawing.Size( EnumsHelper.GetWidth(windowSize), EnumsHelper.GetHeight(windowSize)); var l = Driver.Manage().Window.Size.Height; var fl = Driver.Manage().Window.Size.Width; }
public string RegisterDriver(DriverTypes driverType) { switch (RunType) { case RunTypes.Local: return(RegisterLocalDriver(driverType)); case RunTypes.Remote: return(RegisterRemoteDriver(driverType)); } throw new Exception(); // TODO }
private string RegisterRemoteDriver(DriverTypes driverType) { var capabilities = new DesiredCapabilities(new Dictionary <string, object> { { "browserName", _driverNamesDictionary[driverType] }, { "version", Empty }, { "javaScript", true } }); return(RegisterDriver("Remote_" + _driverNamesDictionary[driverType], () => new RemoteWebDriver(new Uri(Default.remote_url), capabilities))); }
public void InitializeDriver() { DriverTypes driverType = (DriverTypes)System.Enum.Parse(typeof(DriverTypes), ConfigurationManager.AppSettings["Browser"].ToString()); int implicitWait = int.Parse(ConfigurationManager.AppSettings["ImplicitTime"].ToString()); int explicitWait = int.Parse(ConfigurationManager.AppSettings["ExplicitTime"].ToString()); webDriver = DriverFactory.GetDriver(driverType); webDriver.Manage().Window.Maximize(); webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(implicitWait); webDriverWait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(explicitWait)); }
private IWebDriver GetDriver(DriverTypes driver) { switch (driver) { case DriverTypes.Chrome: return(new ChromeDriver(@"C:\Users\ya\Source\Repos\ScreenshotTesting\Steps\bin\Debug")); case DriverTypes.FireFox: return(new FirefoxDriver()); case DriverTypes.IE: return(new InternetExplorerDriver()); case DriverTypes.Opera: return(new OperaDriver()); default: return(null); } }
//TODO private String RegisterLocalDriver(DriverTypes driverType) { var driverName = _driversDictionary[driverType]; switch (driverType) { case DriverTypes.Chrome: return(RegisterDriver(driverName, () => new ChromeDriver(DriverPath))); case DriverTypes.Firefox: return(RegisterDriver(driverName, () => new FirefoxDriver())); case DriverTypes.IE: return(RegisterDriver(driverName, () => new InternetExplorerDriver(DriverPath))); } throw new Exception(); // TODO }
public static IWebDriver CreateDriver(DriverTypes type) { string pathToDrivers = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\"); switch (type) { case (DriverTypes.Chrome): return(new ChromeDriver(pathToDrivers)); case (DriverTypes.Edge): return(new EdgeDriver(pathToDrivers)); case (DriverTypes.Explorer): return(new InternetExplorerDriver(InternetExplorerDriverService.CreateDefaultService(pathToDrivers))); default: throw new ArgumentException("Incorrect type."); } }
public SegmentFactory GetFactory(DriverTypes driverType) { SegmentFactory newFactory = null; string driverTypeDescription = EnumUtils.stringValueOf(driverType); // Using custom attributes on the defined HL7 Segment Factory classes, we // can find the proper class to create an instance of. Doing it this // way, this factory class does not have to be updated each time a // new driver type is added. var types = from a in AppDomain.CurrentDomain.GetAssemblies() from t in a.GetTypes() where t.IsDefined(typeof(HL7SegmentFactoryAttribute), true) select t; foreach (Type t in types) { var attributes = t.GetCustomAttributes(typeof(HL7SegmentFactoryAttribute), true); foreach (HL7SegmentFactoryAttribute a in attributes) { if (a.DriverType == driverTypeDescription) { object[] constructorArgs = { _delimiters }; object obj = Activator.CreateInstance(t, constructorArgs); newFactory = (SegmentFactory)obj; break; } } if (newFactory != null) { break; } } return(newFactory); }
/// <summary> /// The return driver types. /// </summary> /// <param name="driverTypeId"> /// The driver type id. /// </param> /// <returns> /// The <see cref="List"/>. /// </returns> public static List <IDriverType> ReturnDriverTypes(Guid driverTypeId) { if (DriverTypes == null || !DriverTypes.Any()) { return(null); } List <IDriverType> result = new List <IDriverType>(); foreach (Lazy <IDriverType, IDictionary <string, object> > foundDriverType in DriverTypes) { if (foundDriverType.Value.Id == driverTypeId) { if (!result.Any(d => d.Id == foundDriverType.Value.Id)) { result.Add(foundDriverType.Value); } } } return(result); }
/// <summary> /// Converts a DriverTypes enum to the string equivalent /// </summary> /// <param name="driverType">The requested type</param> /// <returns>The equivalent in string form, often used to search the registry</returns> public static string DriverString(DriverTypes driverType) { switch (driverType) { case DriverTypes.Camera: return("Camera"); case DriverTypes.CoverCalibrator: return("CoverCalibrator"); case DriverTypes.Dome: return("Dome"); case DriverTypes.FilterWheel: return("FilterWheel"); case DriverTypes.Focuser: return("Focuser"); case DriverTypes.ObservingConditions: return("ObservingConditions"); case DriverTypes.Rotator: return("Rotator"); case DriverTypes.SafetyMonitor: return("SafetyMonitor"); case DriverTypes.Switch: return("Switch"); case DriverTypes.Telescope: return("Telescope"); case DriverTypes.Video: return("Video"); } throw new Exception("Unknown device type requested;"); }
public SegmentFactory GetFactory(DriverTypes driverType) { SegmentFactory newFactory = null; string driverTypeDescription = EnumUtils.stringValueOf(driverType); // Using custom attributes on the defined HL7 Segment Factory classes, we // can find the proper class to create an instance of. Doing it this // way, this factory class does not have to be updated each time a // new driver type is added. var types = from a in AppDomain.CurrentDomain.GetAssemblies() from t in a.GetTypes() where t.IsDefined(typeof(HL7SegmentFactoryAttribute), true) select t; foreach (Type t in types) { var attributes = t.GetCustomAttributes(typeof(HL7SegmentFactoryAttribute), true); foreach (HL7SegmentFactoryAttribute a in attributes) { if (a.DriverType == driverTypeDescription) { object[] constructorArgs = { _delimiters }; object obj = Activator.CreateInstance(t, constructorArgs); newFactory = (SegmentFactory)obj; break; } } if (newFactory != null) break; } return newFactory; }
public static void Initialize(DriverTypes driverType) { switch (driverType) { case DriverTypes.Chrome: Instance = new ChromeDriver(); break; case DriverTypes.FireFox: Instance = new FirefoxDriver(); break; case DriverTypes.InternetExplorer: Instance = new InternetExplorerDriver(); break; default: Instance = new ChromeDriver(); break; } //ChromeOptions options = new ChromeOptions(); //driver = new RemoteWebDriver(new Uri(HUB_URL), options); }
public T Init <T>(DriverTypes driverType = DriverTypes.Chrome) where T : Application { DriverName = UseDriver(driverType); return(Init <T>(DriverName)); }
public static T Init <T>(Type siteType, DriverTypes driverType = DriverTypes.Chrome) where T : Application { return(Init <T>(siteType, UseDriver(driverType))); }
private static RemoteWebDriver DriverFactory(DriverTypes driverType, string driverPath) => SeleniumDriverFactory.Factory( Type.GetType(driverType.ToString()), driverPath);
public void Initialize(DriverTypes driverType, string driverPath) { _driver = DriverFactory(driverType, driverPath); _translator = new SeleniumGoogleTranslator(); }
public static string UseDriver(DriverTypes driverName) { return WebDriverFactory.RegisterDriver(driverName); }
public static string UseDriver(DriverTypes driverName) { return(WebDriverFactory.RegisterDriver(driverName)); }
/// <summary> /// Searches the ASCOM Registry for all drivers of a specified driver type /// </summary> /// <param name="DeviceType">The driver type to search for as a DriverType.</param> /// <returns>Returns a list of found ASCOM Devices, this includes ProgID and the friendly Name</returns> public static List <ASCOMRegistration> GetDrivers(DriverTypes DeviceType) { return(GetDrivers(DriverString(DeviceType))); }
public virtual void SetDriverType(DriverTypes driverType) { _driverType = driverType; }
private string RegisterLocalDriver(DriverTypes driverType) { return(RegisterDriver(GetDriverName(_driverNamesDictionary[driverType]), () => WebDriverSettings(_driversDictionary[driverType](DriverPath)))); }
public async Task InitializeAsync(DriverTypes driverType, string driverPath) => await _service.InitializeAsync(driverType, driverPath);
public IWebDriver GetDriver(DriverTypes driverType) { return(GetDriver(_driverNamesDictionary[driverType])); }
public static IWebDriver GetDriver(DriverTypes driverName) => driverName switch {
public ActivityRegistration(Type activityType, Type driverType) : this(activityType) { DriverTypes.Add(driverType); }
private IWebDriver GetDriver(DriverTypes type) { IWebDriver driver = null; switch (type) { case DriverTypes.IE: driver = new InternetExplorerDriver( new InternetExplorerOptions { UnexpectedAlertBehavior = InternetExplorerUnexpectedAlertBehavior.Default, EnableNativeEvents = true, //ForceCreateProcessApi = true, //BrowserCommandLineArguments = "-private", EnsureCleanSession = true }); driver = new NgWebDriver(driver); break; case DriverTypes.Chrome: ChromeOptions options = new ChromeOptions(); options.AddArgument("--disable-plugins"); driver = new ChromeDriver(options); driver = new NgWebDriver(driver); break; } ((NgWebDriver)driver).IgnoreSynchronization = true; return driver; }