Exposes the service provided by the native ChromeDriver executable.
Inheritance: IDisposable
コード例 #1
1
 public void Setup() {
     ChromeService = ChromeDriverService.CreateDefaultService();
     ChromeService.Start();
     Chrome = new RemoteWebDriver(ChromeService.ServiceUrl, DesiredCapabilities.Chrome());
 }
コード例 #2
0
ファイル: WebBrowser.cs プロジェクト: maxraychev/ct
 public static ChromeDriverService CreateAndStartChromeService()
 {
     var driverPath = System.Environment.GetEnvironmentVariable("CHROMEDRIVER");
     _driverService = ChromeDriverService.CreateDefaultService(driverPath);
     _driverService.Start();
     return _driverService;
 }
コード例 #3
0
ファイル: WebHelper.cs プロジェクト: Foton63rus/SMC
 public WebHelper()
 {
     OpenQA.Selenium.Chrome.ChromeDriverService service       = OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService();
     OpenQA.Selenium.Chrome.ChromeOptions       chromeOptions = new OpenQA.Selenium.Chrome.ChromeOptions();
     driver     = new ChromeDriver(service, chromeOptions, TimeSpan.FromSeconds(180));
     baseURL    = "https://scryptmail.com/";
     rnd        = new Random();
     waitPeriod = 30.0;
     logs       = "";
     pathLogs   = System.IO.Directory.GetCurrentDirectory() + @"\logs.txt";
     pathLP     = System.IO.Directory.GetCurrentDirectory() + @"\lp.txt";
     checkLogsFile();
     checkLPFile();
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChromeDriver"/> class using the specified <see cref="ChromeDriverService"/>.
 /// </summary>
 /// <param name="service">The <see cref="ChromeDriverService"/> to use.</param>
 /// <param name="options">The <see cref="ChromeOptions"/> to be used with the Chrome driver.</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 public ChromeDriver(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
     : base(new DriverServiceCommandExecutor(service, commandTimeout), options.ToCapabilities())
 {
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChromeDriver"/> class using the specified 
 /// <see cref="ChromeDriverService"/> and options.
 /// </summary>
 /// <param name="service">The <see cref="ChromeDriverService"/> to use.</param>
 /// <param name="options">The <see cref="ChromeOptions"/> used to initialize the driver.</param>
 public ChromeDriver(ChromeDriverService service, ChromeOptions options)
     : this(service, options, RemoteWebDriver.DefaultCommandTimeout)
 {
 }
コード例 #6
0
ファイル: ChromeDriver.cs プロジェクト: RanchoLi/selenium
 /// <summary>
 /// Initializes a new instance of the <see cref="ChromeDriver"/> class using the specified driver service.
 /// </summary>
 /// <param name="service">The <see cref="ChromeDriverService"/> used to initialize the driver.</param>
 public ChromeDriver(ChromeDriverService service)
     : this(service, new ChromeOptions())
 {
 }
コード例 #7
0
 public void Teardown() {
     Chrome.Quit();
     Chrome.Dispose();
     Chrome = null;
     ChromeService.Dispose();
     ChromeService = null;
 }
コード例 #8
0
 public SpecCompliantChromeDriver(ChromeDriverService service, ChromeOptions options)
     : base(service, options)
 {
 }
コード例 #9
0
 public ChromeDriverWrapper(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
     : base(service, options, commandTimeout)
 {
     SeleniumTestBase.LogDriverId(this, "CTOR - ChromeDriver");
 }
コード例 #10
0
 public ChromeDriverWrapper(ChromeDriverService service, ChromeOptions options)
     : base(service, options)
 {
     SeleniumTestBase.LogDriverId(this, "CTOR - ChromeDriver");
 }
コード例 #11
0
        protected static void StartDriver()
        {
            try
            {
                ChromeDriverService service = null;
                Blackbaud.UAT.SpecFlow.Selenium.RemoteWebDriver driver = null;

                string remoteUrl = ConfigurationManager.AppSettings["RemoteDriver"];
                if ("false" == remoteUrl.ToLower())
                {
                    service = BaseTest.InitializeChromeService();
                    Test.service = service;
                    driver = BaseTest.InitializeChromeDriver(service.ServiceUrl);
                }
                else
                {
                    driver = new Blackbaud.UAT.SpecFlow.Selenium.RemoteWebDriver(new Uri(remoteUrl), DesiredCapabilities.Chrome());
                }

                Test.driver = driver;

                if (Test.service != null)
                    ScenarioContext.Current.Add("Service", service);
                if (Test.driver != null)
                    ScenarioContext.Current.Add("Driver", driver);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                //Do nothing if context is unavailable
            }
        }
コード例 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChromeDriver"/> class using the specified <see cref="ChromeDriverService"/>.
 /// </summary>
 /// <param name="service">The <see cref="ChromeDriverService"/> to use.</param>
 /// <param name="options">The <see cref="ChromeOptions"/> to be used with the Chrome driver.</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 public ChromeDriver(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
     : base(service, options, commandTimeout)
 {
     this.AddCustomChromeCommands();
 }
コード例 #13
0
 public SpecCompliantChromeDriver(ChromeDriverService service)
     : this(service, DefaultOptions)
 {
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChromeCommandExecutor"/> class.
 /// </summary>
 /// <param name="driverService">The <see cref="ChromeDriverService"/> that drives the browser.</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 public ChromeCommandExecutor(ChromeDriverService driverService, TimeSpan commandTimeout)
     : base(GetDriverServiceUrl(driverService), commandTimeout)
 {
     this.service = driverService;
 }
コード例 #15
0
ファイル: ChromeDriver.cs プロジェクト: Goldcap/Constellation
 /// <summary>
 /// Initializes a new instance of the ChromeDriver class using the specified <see cref="ChromeDriverService"/>.
 /// </summary>
 /// <param name="service">The <see cref="ChromeDriverService"/> to use.</param>
 /// <param name="capabilities">The desired capabilities of the Chrome driver.</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 private ChromeDriver(ChromeDriverService service, ICapabilities capabilities, TimeSpan commandTimeout)
     : base(new ChromeCommandExecutor(service, commandTimeout), capabilities)
 {
 }
コード例 #16
0
ファイル: ChromeDriver.cs プロジェクト: asynchrony/Selenium2
 /// <summary>
 /// Initializes a new instance of the ChromeDriver class using the specified <see cref="ChromeDriverService"/>.
 /// </summary>
 /// <param name="service">The <see cref="ChromeDriverService"/> to use.</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 private ChromeDriver(ChromeDriverService service, TimeSpan commandTimeout)
     : base(new ChromeCommandExecutor(service, commandTimeout), DesiredCapabilities.Chrome())
 {
 }
コード例 #17
-1
        private static Uri GetDriverServiceUrl(ChromeDriverService driverService)
        {
            Uri driverUrl = null;
            if (driverService != null)
            {
                driverUrl = driverService.ServiceUrl;
            }

            return driverUrl;
        }