Skip to content

Commit 9ed9272

Browse files
petrucjimevans
authored andcommitted
Adding language bindings for Microsoft Edge browser
Includes client langauge bindings for Java and .NET. Signed-off-by: Jim Evans <james.h.evans.jr@gmail.com>
1 parent dff13ad commit 9ed9272

File tree

15 files changed

+824
-14
lines changed

15 files changed

+824
-14
lines changed

WebDriver.sln

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
Microsoft Visual Studio Solution File, Format Version 11.00
2-
# Visual Studio 2010
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio 14
3+
VisualStudioVersion = 14.0.22310.1
4+
MinimumVisualStudioVersion = 10.0.40219.1
35
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "web", "common\src\web\", "{DB560F4B-1F41-4E8E-AC06-640D736E8A72}"
46
ProjectSection(WebsiteProperties) = preProject
57
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
@@ -20,6 +22,7 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "web", "common\src\web\", "{
2022
VWDPort = "2311"
2123
VWDDynamicPort = "false"
2224
VWDVirtualPath = "/common"
25+
SlnRelativePath = "common\src\web\"
2326
DefaultWebSiteLanguage = "Visual C#"
2427
StartServerOnDebug = "false"
2528
EndProjectSection
@@ -80,16 +83,26 @@ Global
8083
Release|x64 = Release|x64
8184
EndGlobalSection
8285
GlobalSection(ProjectConfigurationPlatforms) = postSolution
83-
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|.NET.ActiveCfg = Debug|.NET
84-
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Any CPU.ActiveCfg = Debug|.NET
85-
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Mixed Platforms.ActiveCfg = Debug|.NET
86-
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Win32.ActiveCfg = Debug|.NET
87-
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|x64.ActiveCfg = Debug|.NET
88-
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|.NET.ActiveCfg = Debug|.NET
89-
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Any CPU.ActiveCfg = Debug|.NET
90-
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Mixed Platforms.ActiveCfg = Debug|.NET
91-
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Win32.ActiveCfg = Debug|.NET
92-
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|x64.ActiveCfg = Debug|.NET
86+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|.NET.ActiveCfg = Debug|Any CPU
87+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|.NET.Build.0 = Debug|Any CPU
88+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
89+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Any CPU.Build.0 = Debug|Any CPU
90+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
91+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
92+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Win32.ActiveCfg = Debug|Any CPU
93+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Win32.Build.0 = Debug|Any CPU
94+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|x64.ActiveCfg = Debug|Any CPU
95+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|x64.Build.0 = Debug|Any CPU
96+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|.NET.ActiveCfg = Debug|Any CPU
97+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|.NET.Build.0 = Debug|Any CPU
98+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Any CPU.ActiveCfg = Debug|Any CPU
99+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Any CPU.Build.0 = Debug|Any CPU
100+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Mixed Platforms.ActiveCfg = Debug|Any CPU
101+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Mixed Platforms.Build.0 = Debug|Any CPU
102+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Win32.ActiveCfg = Debug|Any CPU
103+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Win32.Build.0 = Debug|Any CPU
104+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|x64.ActiveCfg = Debug|Any CPU
105+
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|x64.Build.0 = Debug|Any CPU
93106
{87FA39A1-958E-478A-8AB9-6D5E5AAA3886}.Debug|.NET.ActiveCfg = Debug|Win32
94107
{87FA39A1-958E-478A-8AB9-6D5E5AAA3886}.Debug|Any CPU.ActiveCfg = Debug|Win32
95108
{87FA39A1-958E-478A-8AB9-6D5E5AAA3886}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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+
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// <copyright file="EdgeDriverService.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.Globalization;
22+
using System.IO;
23+
using System.Text;
24+
using OpenQA.Selenium.Internal;
25+
26+
namespace OpenQA.Selenium.Edge
27+
{
28+
/// <summary>
29+
/// Exposes the service provided by the native MicrosoftWebDriver executable.
30+
/// </summary>
31+
public sealed class EdgeDriverService : DriverService
32+
{
33+
private const string MicrosoftWebDriverServiceFileName = "MicrosoftWebDriver.exe";
34+
private static readonly Uri MicrosoftWebDriverDownloadUrl = new Uri("http://download.microsoft.com/download/6/D/7/6D7B7A44-B792-4CB4-AEC3-4C190EB99F85/MicrosoftWebDriver.msi");
35+
private string logPath = string.Empty;
36+
private string urlPathPrefix = string.Empty;
37+
private string portServerAddress = string.Empty;
38+
39+
40+
/// <summary>
41+
/// Initializes a new instance of the EdgeDriverService class.
42+
/// </summary>
43+
/// <param name="executablePath">The full path to the EdgeDriver executable.</param>
44+
/// <param name="executableFileName">The file name of the EdgeDriver executable.</param>
45+
/// <param name="port">The port on which the EdgeDriver executable should listen.</param>
46+
private EdgeDriverService(string executablePath, string executableFileName, int port)
47+
: base(executablePath, port, executableFileName, MicrosoftWebDriverDownloadUrl)
48+
{
49+
}
50+
51+
/// <summary>
52+
/// Creates a default instance of the EdgeDriverService.
53+
/// </summary>
54+
/// <returns>A EdgeDriverService that implements default settings.</returns>
55+
public static EdgeDriverService CreateDefaultService()
56+
{
57+
string serviceDirectory = DriverService.FindDriverServiceExecutable(MicrosoftWebDriverServiceFileName, MicrosoftWebDriverDownloadUrl);
58+
return CreateDefaultService(serviceDirectory);
59+
}
60+
61+
/// <summary>
62+
/// Creates a default instance of the EdgeDriverService using a specified path to the EdgeDriver executable.
63+
/// </summary>
64+
/// <param name="driverPath">The directory containing the EdgeDriver executable.</param>
65+
/// <returns>A EdgeDriverService using a random port.</returns>
66+
public static EdgeDriverService CreateDefaultService(string driverPath)
67+
{
68+
return CreateDefaultService(driverPath, MicrosoftWebDriverServiceFileName);
69+
}
70+
71+
/// <summary>
72+
/// Creates a default instance of the EdgeDriverService using a specified path to the EdgeDriver executable with the given name.
73+
/// </summary>
74+
/// <param name="driverPath">The directory containing the EdgeDriver executable.</param>
75+
/// <param name="driverExecutableFileName">The name of the EdgeDriver executable file.</param>
76+
/// <returns>A EdgeDriverService using a random port.</returns>
77+
public static EdgeDriverService CreateDefaultService(string driverPath, string driverExecutableFileName)
78+
{
79+
return new EdgeDriverService(driverPath, driverExecutableFileName, PortUtilities.FindFreePort());
80+
}
81+
82+
/// <summary>
83+
/// Creates a default instance of the EdgeDriverService using a specified path to the EdgeDriver executable with the given name and listening port.
84+
/// </summary>
85+
/// <param name="driverPath">The directory containing the EdgeDriver executable.</param>
86+
/// <param name="driverExecutableFileName">The name of the EdgeDriver executable file</param>
87+
/// <param name="port">The port number on which the driver will listen</param>
88+
/// <returns></returns>
89+
public static EdgeDriverService CreateDefaultService(string driverPath, string driverExecutableFileName, int port)
90+
{
91+
return new EdgeDriverService(driverPath, driverExecutableFileName, port);
92+
}
93+
}
94+
}

0 commit comments

Comments
 (0)