示例#1
0
        public void StartDriver(DriverConfiguration configuration)
        {
            configuration.DriverServices      = configuration.DriverServices ?? DriverServices;
            configuration.DesiredCapabilities = configuration.DesiredCapabilities ?? DesiredCapabilities;
            AndroidDriver <AppiumWebElement> driver = new AndroidDriver <AppiumWebElement>((AppiumServiceBuilder)configuration.DriverServices, (DesiredCapabilities)configuration.DesiredCapabilities, TimeSpan.FromSeconds(configuration.CommandTimeout));

            driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(configuration.PageLoadTimeout));
            driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(configuration.ScriptTimeout));
            Driver = driver;
        }
        public void StartDriver(DriverConfiguration configuarion)
        {
            configuarion.DesiredCapabilities = configuarion.DesiredCapabilities ?? DesiredCapabilities;
            RemoteWebDriver driver = new RemoteWebDriver(configuarion.RemoteUri, (DesiredCapabilities)configuarion.DesiredCapabilities, TimeSpan.FromSeconds(configuarion.CommandTimeout));

            driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(configuarion.PageLoadTimeout));
            driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(configuarion.ScriptTimeout));
            if (configuarion.MaximizeBrowser)
            {
                driver.Manage().Window.Maximize();
            }
            Driver = driver;
        }
示例#3
0
        public void StartDriver(DriverConfiguration configuration)
        {
            configuration.DriverServices      = configuration.DriverServices ?? DriverServices;
            configuration.DesiredCapabilities = configuration.DesiredCapabilities ?? DesiredCapabilities;
            IWebDriver driver = new InternetExplorerDriver((InternetExplorerDriverService)configuration.DriverServices, (InternetExplorerOptions)configuration.DesiredCapabilities, TimeSpan.FromSeconds(configuration.CommandTimeout));

            driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(configuration.PageLoadTimeout));
            driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(configuration.ScriptTimeout));
            if (configuration.MaximizeBrowser)
            {
                driver.Manage().Window.Maximize();
            }
            Driver = driver;
        }
示例#4
0
        public void StartDriver(DriverConfiguration configuration)
        {
            configuration.DriverServices      = configuration.DriverServices ?? DriverServices;
            configuration.DesiredCapabilities = configuration.DesiredCapabilities ?? DesiredCapabilities;
            IWebDriver driver = new FirefoxDriver((FirefoxBinary)configuration.DriverServices, (FirefoxProfile)configuration.DesiredCapabilities, TimeSpan.FromSeconds(configuration.CommandTimeout));

            driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(configuration.PageLoadTimeout));
            driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(configuration.ScriptTimeout));
            if (configuration.MaximizeBrowser)
            {
                driver.Manage().Window.Maximize();
            }
            Driver = driver;
        }
示例#5
0
        public void StartDriver(DriverConfiguration configuration)
        {
            configuration.DriverServices      = configuration.DriverServices ?? DriverServices;
            configuration.DesiredCapabilities = configuration.DesiredCapabilities ?? DesiredCapabilities;
            var options = (ChromeOptions)configuration.DesiredCapabilities;

            options.AddArgument("--user-agent=Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/9.0 Mobile/10A5355d Safari/8536.25");
            IWebDriver driver = new ChromeDriver((ChromeDriverService)configuration.DriverServices, options, TimeSpan.FromSeconds(configuration.CommandTimeout));

            driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(configuration.PageLoadTimeout));
            driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(configuration.ScriptTimeout));
            if (configuration.MaximizeBrowser)
            {
                driver.Manage().Window.Maximize();
            }
            Driver = driver;
        }
        public void StartDriver(DriverConfiguration configuration)
        {
            configuration.DriverServices      = configuration.DriverServices ?? DriverServices;
            configuration.DesiredCapabilities = configuration.DesiredCapabilities ?? DesiredCapabilities;
            var options = (ChromeOptions)configuration.DesiredCapabilities;

            options.EnableMobileEmulation("Google Nexus 7");
            IWebDriver driver = new ChromeDriver((ChromeDriverService)configuration.DriverServices, options, TimeSpan.FromSeconds(configuration.CommandTimeout));

            driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(configuration.PageLoadTimeout));
            driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(configuration.ScriptTimeout));
            if (configuration.MaximizeBrowser)
            {
                driver.Manage().Window.Maximize();
            }
            Driver = driver;
        }
示例#7
0
        /// <summary>
        /// This method is use for instance driver
        /// </summary>
        /// <param name="factoryType"></param>
        /// <param name="type"></param>
        /// <param name="configuaration"></param>
        public static void StartDriver(Browser type, DriverConfiguration driverConfiguaration = null)
        {
            driverConfiguaration = driverConfiguaration ?? new DriverConfiguration();
            Type foundClass = Assembly.GetExecutingAssembly().GetTypes()
                              .Where(item => item.Namespace == Constants.DRIVER_NAME_SPACE && item.Name.Equals(type.ToString(), StringComparison.OrdinalIgnoreCase))
                              .FirstOrDefault();

            if (foundClass != null)
            {
                object     instance  = Activator.CreateInstance(foundClass);
                Type       classType = instance.GetType();
                MethodInfo method    = classType.GetMethod("StartDriver", BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance);
                method.Invoke(instance, new object[] { driverConfiguaration });
                PropertyInfo property = classType.GetProperty("Driver");
                DriverStored = property.GetValue(instance, null);
            }
            else
            {
                throw new OperationCanceledException("WebBrowser for" + type + " is not implemented");
            }
        }
示例#8
0
 public void StartDriver(DriverConfiguration configuration)
 {
     configuration.DriverServices      = configuration.DriverServices ?? DriverServices;
     configuration.DesiredCapabilities = configuration.DesiredCapabilities ?? DesiredCapabilities;
     Driver = new PhantomJSDriver((PhantomJSDriverService)configuration.DriverServices, (PhantomJSOptions)configuration.DesiredCapabilities, TimeSpan.FromSeconds(configuration.CommandTimeout));
 }