17
17
// </copyright>
18
18
19
19
using System ;
20
+ using System . Globalization ;
21
+ using System . Text ;
20
22
using OpenQA . Selenium . Internal ;
21
23
22
24
namespace OpenQA . Selenium . Edge
@@ -28,6 +30,9 @@ public sealed class EdgeDriverService : DriverService
28
30
{
29
31
private const string MicrosoftWebDriverServiceFileName = "MicrosoftWebDriver.exe" ;
30
32
private static readonly Uri MicrosoftWebDriverDownloadUrl = new Uri ( "http://go.microsoft.com/fwlink/?LinkId=619687" ) ;
33
+ private string host ;
34
+ private string package ;
35
+ private bool useVerboseLogging ;
31
36
32
37
/// <summary>
33
38
/// Initializes a new instance of the <see cref="EdgeDriverService"/> class.
@@ -40,14 +45,69 @@ private EdgeDriverService(string executablePath, string executableFileName, int
40
45
{
41
46
}
42
47
48
+ /// <summary>
49
+ /// Gets or sets the value of the host adapter on which the Edge driver service should listen for connections.
50
+ /// </summary>
51
+ public string Host
52
+ {
53
+ get { return this . host ; }
54
+ set { this . host = value ; }
55
+ }
56
+
57
+ /// <summary>
58
+ /// Gets or sets the value of the package the Edge driver service will launch and automate.
59
+ /// </summary>
60
+ public string Package
61
+ {
62
+ get { return this . package ; }
63
+ set { this . package = value ; }
64
+ }
65
+
66
+ /// <summary>
67
+ /// Gets or sets a value indicating whether the service should use verbose logging.
68
+ /// </summary>
69
+ public bool UseVerboseLogging
70
+ {
71
+ get { return this . useVerboseLogging ; }
72
+ set { this . useVerboseLogging = value ; }
73
+ }
74
+
75
+ /// <summary>
76
+ /// Gets the command-line arguments for the driver service.
77
+ /// </summary>
78
+ protected override string CommandLineArguments
79
+ {
80
+ get
81
+ {
82
+ StringBuilder argsBuilder = new StringBuilder ( base . CommandLineArguments ) ;
83
+ if ( ! string . IsNullOrEmpty ( this . host ) )
84
+ {
85
+ argsBuilder . Append ( string . Format ( CultureInfo . InvariantCulture , " --host={0}" , this . host ) ) ;
86
+ }
87
+
88
+ if ( ! string . IsNullOrEmpty ( this . package ) )
89
+ {
90
+ argsBuilder . Append ( string . Format ( CultureInfo . InvariantCulture , " --package={0}" , this . package ) ) ;
91
+ }
92
+
93
+ if ( this . useVerboseLogging )
94
+ {
95
+ argsBuilder . Append ( " --verbose" ) ;
96
+ }
97
+
98
+ return argsBuilder . ToString ( ) ;
99
+ }
100
+ }
101
+
43
102
/// <summary>
44
103
/// Creates a default instance of the EdgeDriverService.
45
104
/// </summary>
46
105
/// <returns>A EdgeDriverService that implements default settings.</returns>
47
106
public static EdgeDriverService CreateDefaultService ( )
48
107
{
49
108
string serviceDirectory = DriverService . FindDriverServiceExecutable ( MicrosoftWebDriverServiceFileName , MicrosoftWebDriverDownloadUrl ) ;
50
- return CreateDefaultService ( serviceDirectory ) ;
109
+ EdgeDriverService service = CreateDefaultService ( serviceDirectory ) ;
110
+ return service ;
51
111
}
52
112
53
113
/// <summary>
0 commit comments