예제 #1
0
        //TODO: return to version 1.5.2 for all devices after iOS issue will be fixed
        //const string APPIUM_VERSION = "1.5.2";
        /// <summary>
        /// Create selenium driver
        /// According to the given parameters decides if to create a desktop/ios/android driver
        /// </summary>
        /// <param name="parameters"></param>
        /// <param name="testName"></param>
        /// <param name="isMobile"></param>
        /// <returns></returns>
        internal static RemoteWebDriver CreateDriver(DriverParameters parameters)
        {
            RemoteWebDriver     driver = null;
            DesiredCapabilities caps   = new DesiredCapabilities();

            if (parameters.BrowserName == "Chrome")
            {
                driver = createChromeDriver(parameters.SeleniumHub);
            }
            else if (parameters.BrowserName == "PhantomJS")
            {
                driver = createPhantomJSDriver(parameters.SeleniumHub);
            }
            else if (parameters.BrowserName == "Firefox")
            {
                FirefoxProfile profile = new FirefoxProfile();
                profile.SetPreference("plugin.state.flash", 0);
                caps.SetCapability(FirefoxDriver.ProfileCapabilityName, profile);
            }
            else
            {
                caps.SetCapability(CapabilityType.BrowserName, parameters.BrowserName);
                caps.SetCapability(CapabilityType.Version, parameters.VersionDesktop);
                caps.SetCapability(CapabilityType.Platform, parameters.PlatformDesktop);
                caps.SetCapability(CapabilityType.IsJavaScriptEnabled, true);
                caps.SetCapability(CapabilityType.PageLoadStrategy, "eager");
                caps.SetCapability("idleTimeout", 300);
                return(driver = new RemoteWebDriver(new Uri(parameters.SeleniumHub), caps, TimeSpan.FromSeconds(180)));
            }
            return(driver);
        }
예제 #2
0
 public BaseBrowser(DriverParameters driverParameters)
 {
     _driverParameters = driverParameters;
     Driver            = DriverFactory.CreateDriver(driverParameters);
     Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
 }