| 
 | 1 | +// <copyright file="EdgeDriver.cs" company="Microsoft">  | 
 | 2 | +// Licensed to the Software Freedom Conservancy (SFC) under one  | 
 | 3 | +// or more contributor license agreements. See the NOTICE file  | 
 | 4 | +// distributed with this work for additional information  | 
 | 5 | +// regarding copyright ownership. The SFC licenses this file  | 
 | 6 | +// to you under the Apache License, Version 2.0 (the "License");  | 
 | 7 | +// you may not use this file except in compliance with the License.  | 
 | 8 | +// You may obtain a copy of the License at  | 
 | 9 | +//  | 
 | 10 | +// http://www.apache.org/licenses/LICENSE-2.0  | 
 | 11 | +//  | 
 | 12 | +// Unless required by applicable law or agreed to in writing, software  | 
 | 13 | +// distributed under the License is distributed on an "AS IS" BASIS,  | 
 | 14 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  | 
 | 15 | +// See the License for the specific language governing permissions and  | 
 | 16 | +// limitations under the License.  | 
 | 17 | +// </copyright>  | 
 | 18 | + | 
 | 19 | +using System;  | 
 | 20 | +using System.Collections.Generic;  | 
 | 21 | +using System.Collections.ObjectModel;  | 
 | 22 | +using OpenQA.Selenium.Internal;  | 
 | 23 | +using OpenQA.Selenium.Remote;  | 
 | 24 | + | 
 | 25 | +namespace OpenQA.Selenium.Edge  | 
 | 26 | +{  | 
 | 27 | + /// <summary>  | 
 | 28 | + /// Provides a mechanism to write tests against Edge  | 
 | 29 | + /// </summary>  | 
 | 30 | + public class EdgeDriver : RemoteWebDriver  | 
 | 31 | + {  | 
 | 32 | + #region Constructors  | 
 | 33 | + /// <summary>  | 
 | 34 | + /// Initializes a new instance of the <see cref="EdgeDriver"/> class.  | 
 | 35 | + /// </summary>  | 
 | 36 | + public EdgeDriver()  | 
 | 37 | + : this(new EdgeOptions())  | 
 | 38 | + {  | 
 | 39 | + }  | 
 | 40 | + | 
 | 41 | + /// <summary>  | 
 | 42 | + /// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified options.  | 
 | 43 | + /// </summary>  | 
 | 44 | + /// <param name="options">The <see cref="EdgeOptions"/> to be used with the Edge driver.</param>  | 
 | 45 | + public EdgeDriver(EdgeOptions options)  | 
 | 46 | + : this(EdgeDriverService.CreateDefaultService(), options, RemoteWebDriver.DefaultCommandTimeout)  | 
 | 47 | + {  | 
 | 48 | + }  | 
 | 49 | + | 
 | 50 | + /// <summary>  | 
 | 51 | + /// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified driver service.  | 
 | 52 | + /// </summary>  | 
 | 53 | + /// <param name="service">The <see cref="EdgeDriverService"/> used to initialize the driver.</param>  | 
 | 54 | + public EdgeDriver(EdgeDriverService service)  | 
 | 55 | + : this(service, new EdgeOptions())  | 
 | 56 | + {  | 
 | 57 | + }  | 
 | 58 | + | 
 | 59 | + /// <summary>  | 
 | 60 | + /// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified path   | 
 | 61 | + /// to the directory containing EdgeDriver.exe.  | 
 | 62 | + /// </summary>  | 
 | 63 | + /// <param name="EdgeDriverDirectory">The full path to the directory containing EdgeDriver.exe.</param>  | 
 | 64 | + public EdgeDriver(string EdgeDriverDirectory)  | 
 | 65 | + : this(EdgeDriverDirectory, new EdgeOptions())  | 
 | 66 | + {  | 
 | 67 | + }  | 
 | 68 | + | 
 | 69 | + /// <summary>  | 
 | 70 | + /// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified path  | 
 | 71 | + /// to the directory containing EdgeDriver.exe and options.  | 
 | 72 | + /// </summary>  | 
 | 73 | + /// <param name="EdgeDriverDirectory">The full path to the directory containing EdgeDriver.exe.</param>  | 
 | 74 | + /// <param name="options">The <see cref="EdgeOptions"/> to be used with the Edge driver.</param>  | 
 | 75 | + public EdgeDriver(string EdgeDriverDirectory, EdgeOptions options)  | 
 | 76 | + : this(EdgeDriverDirectory, options, RemoteWebDriver.DefaultCommandTimeout)  | 
 | 77 | + {  | 
 | 78 | + }  | 
 | 79 | + | 
 | 80 | + /// <summary>  | 
 | 81 | + /// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified path  | 
 | 82 | + /// to the directory containing EdgeDriver.exe, options, and command timeout.  | 
 | 83 | + /// </summary>  | 
 | 84 | + /// <param name="EdgeDriverDirectory">The full path to the directory containing EdgeDriver.exe.</param>  | 
 | 85 | + /// <param name="options">The <see cref="EdgeOptions"/> to be used with the Edge driver.</param>  | 
 | 86 | + /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>  | 
 | 87 | + public EdgeDriver(string EdgeDriverDirectory, EdgeOptions options, TimeSpan commandTimeout)  | 
 | 88 | + : this(EdgeDriverService.CreateDefaultService(EdgeDriverDirectory), options, commandTimeout)  | 
 | 89 | + {  | 
 | 90 | + }  | 
 | 91 | + | 
 | 92 | + /// <summary>  | 
 | 93 | + /// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified   | 
 | 94 | + /// <see cref="EdgeDriverService"/> and options.  | 
 | 95 | + /// </summary>  | 
 | 96 | + /// <param name="service">The <see cref="EdgeDriverService"/> to use.</param>  | 
 | 97 | + /// <param name="options">The <see cref="EdgeOptions"/> used to initialize the driver.</param>  | 
 | 98 | + public EdgeDriver(EdgeDriverService service, EdgeOptions options)  | 
 | 99 | + : this(service, options, RemoteWebDriver.DefaultCommandTimeout)  | 
 | 100 | + {  | 
 | 101 | + }  | 
 | 102 | + | 
 | 103 | + /// <summary>  | 
 | 104 | + /// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified <see cref="EdgeDriverService"/>.  | 
 | 105 | + /// </summary>  | 
 | 106 | + /// <param name="service">The <see cref="EdgeDriverService"/> to use.</param>  | 
 | 107 | + /// <param name="options">The <see cref="EdgeOptions"/> to be used with the Edge driver.</param>  | 
 | 108 | + /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>  | 
 | 109 | + public EdgeDriver(EdgeDriverService service, EdgeOptions options, TimeSpan commandTimeout)  | 
 | 110 | + : base(new DriverServiceCommandExecutor(service, commandTimeout), options.ToCapabilities())  | 
 | 111 | + {  | 
 | 112 | + }  | 
 | 113 | + #endregion  | 
 | 114 | + }  | 
 | 115 | +}  | 
 | 116 | + | 
0 commit comments