Skip to content

Commit

Permalink
Adding language bindings for Microsoft Edge browser
Browse files Browse the repository at this point in the history
Includes client langauge bindings for Java and .NET.

Signed-off-by: Jim Evans <james.h.evans.jr@gmail.com>
  • Loading branch information
petruc authored and jimevans committed Jul 22, 2015
1 parent dff13ad commit 9ed9272
Show file tree
Hide file tree
Showing 15 changed files with 824 additions and 14 deletions.
37 changes: 25 additions & 12 deletions WebDriver.sln
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22310.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "web", "common\src\web\", "{DB560F4B-1F41-4E8E-AC06-640D736E8A72}"
ProjectSection(WebsiteProperties) = preProject
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
Expand All @@ -20,6 +22,7 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "web", "common\src\web\", "{
VWDPort = "2311"
VWDDynamicPort = "false"
VWDVirtualPath = "/common"
SlnRelativePath = "common\src\web\"
DefaultWebSiteLanguage = "Visual C#"
StartServerOnDebug = "false"
EndProjectSection
Expand Down Expand Up @@ -80,16 +83,26 @@ Global
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|.NET.ActiveCfg = Debug|.NET
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Any CPU.ActiveCfg = Debug|.NET
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Mixed Platforms.ActiveCfg = Debug|.NET
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Win32.ActiveCfg = Debug|.NET
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|x64.ActiveCfg = Debug|.NET
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|.NET.ActiveCfg = Debug|.NET
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Any CPU.ActiveCfg = Debug|.NET
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Mixed Platforms.ActiveCfg = Debug|.NET
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Win32.ActiveCfg = Debug|.NET
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|x64.ActiveCfg = Debug|.NET
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|.NET.ActiveCfg = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|.NET.Build.0 = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Win32.ActiveCfg = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|Win32.Build.0 = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|x64.ActiveCfg = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Debug|x64.Build.0 = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|.NET.ActiveCfg = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|.NET.Build.0 = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Any CPU.Build.0 = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Mixed Platforms.ActiveCfg = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Mixed Platforms.Build.0 = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Win32.ActiveCfg = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|Win32.Build.0 = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|x64.ActiveCfg = Debug|Any CPU
{DB560F4B-1F41-4E8E-AC06-640D736E8A72}.Release|x64.Build.0 = Debug|Any CPU
{87FA39A1-958E-478A-8AB9-6D5E5AAA3886}.Debug|.NET.ActiveCfg = Debug|Win32
{87FA39A1-958E-478A-8AB9-6D5E5AAA3886}.Debug|Any CPU.ActiveCfg = Debug|Win32
{87FA39A1-958E-478A-8AB9-6D5E5AAA3886}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
Expand Down
116 changes: 116 additions & 0 deletions dotnet/src/webdriver/Edge/EdgeDriver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// <copyright file="EdgeDriver.cs" company="Microsoft">
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using OpenQA.Selenium.Internal;
using OpenQA.Selenium.Remote;

namespace OpenQA.Selenium.Edge
{
/// <summary>
/// Provides a mechanism to write tests against Edge
/// </summary>
public class EdgeDriver : RemoteWebDriver
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="EdgeDriver"/> class.
/// </summary>
public EdgeDriver()
: this(new EdgeOptions())
{
}

/// <summary>
/// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified options.
/// </summary>
/// <param name="options">The <see cref="EdgeOptions"/> to be used with the Edge driver.</param>
public EdgeDriver(EdgeOptions options)
: this(EdgeDriverService.CreateDefaultService(), options, RemoteWebDriver.DefaultCommandTimeout)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified driver service.
/// </summary>
/// <param name="service">The <see cref="EdgeDriverService"/> used to initialize the driver.</param>
public EdgeDriver(EdgeDriverService service)
: this(service, new EdgeOptions())
{
}

/// <summary>
/// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified path
/// to the directory containing EdgeDriver.exe.
/// </summary>
/// <param name="EdgeDriverDirectory">The full path to the directory containing EdgeDriver.exe.</param>
public EdgeDriver(string EdgeDriverDirectory)
: this(EdgeDriverDirectory, new EdgeOptions())
{
}

/// <summary>
/// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified path
/// to the directory containing EdgeDriver.exe and options.
/// </summary>
/// <param name="EdgeDriverDirectory">The full path to the directory containing EdgeDriver.exe.</param>
/// <param name="options">The <see cref="EdgeOptions"/> to be used with the Edge driver.</param>
public EdgeDriver(string EdgeDriverDirectory, EdgeOptions options)
: this(EdgeDriverDirectory, options, RemoteWebDriver.DefaultCommandTimeout)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified path
/// to the directory containing EdgeDriver.exe, options, and command timeout.
/// </summary>
/// <param name="EdgeDriverDirectory">The full path to the directory containing EdgeDriver.exe.</param>
/// <param name="options">The <see cref="EdgeOptions"/> to be used with the Edge driver.</param>
/// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
public EdgeDriver(string EdgeDriverDirectory, EdgeOptions options, TimeSpan commandTimeout)
: this(EdgeDriverService.CreateDefaultService(EdgeDriverDirectory), options, commandTimeout)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified
/// <see cref="EdgeDriverService"/> and options.
/// </summary>
/// <param name="service">The <see cref="EdgeDriverService"/> to use.</param>
/// <param name="options">The <see cref="EdgeOptions"/> used to initialize the driver.</param>
public EdgeDriver(EdgeDriverService service, EdgeOptions options)
: this(service, options, RemoteWebDriver.DefaultCommandTimeout)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="EdgeDriver"/> class using the specified <see cref="EdgeDriverService"/>.
/// </summary>
/// <param name="service">The <see cref="EdgeDriverService"/> to use.</param>
/// <param name="options">The <see cref="EdgeOptions"/> to be used with the Edge driver.</param>
/// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
public EdgeDriver(EdgeDriverService service, EdgeOptions options, TimeSpan commandTimeout)
: base(new DriverServiceCommandExecutor(service, commandTimeout), options.ToCapabilities())
{
}
#endregion
}
}

94 changes: 94 additions & 0 deletions dotnet/src/webdriver/Edge/EdgeDriverService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// <copyright file="EdgeDriverService.cs" company="Microsoft">
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using OpenQA.Selenium.Internal;

namespace OpenQA.Selenium.Edge
{
/// <summary>
/// Exposes the service provided by the native MicrosoftWebDriver executable.
/// </summary>
public sealed class EdgeDriverService : DriverService
{
private const string MicrosoftWebDriverServiceFileName = "MicrosoftWebDriver.exe";
private static readonly Uri MicrosoftWebDriverDownloadUrl = new Uri("http://download.microsoft.com/download/6/D/7/6D7B7A44-B792-4CB4-AEC3-4C190EB99F85/MicrosoftWebDriver.msi");
private string logPath = string.Empty;
private string urlPathPrefix = string.Empty;
private string portServerAddress = string.Empty;


/// <summary>
/// Initializes a new instance of the EdgeDriverService class.
/// </summary>
/// <param name="executablePath">The full path to the EdgeDriver executable.</param>
/// <param name="executableFileName">The file name of the EdgeDriver executable.</param>
/// <param name="port">The port on which the EdgeDriver executable should listen.</param>
private EdgeDriverService(string executablePath, string executableFileName, int port)
: base(executablePath, port, executableFileName, MicrosoftWebDriverDownloadUrl)
{
}

/// <summary>
/// Creates a default instance of the EdgeDriverService.
/// </summary>
/// <returns>A EdgeDriverService that implements default settings.</returns>
public static EdgeDriverService CreateDefaultService()
{
string serviceDirectory = DriverService.FindDriverServiceExecutable(MicrosoftWebDriverServiceFileName, MicrosoftWebDriverDownloadUrl);
return CreateDefaultService(serviceDirectory);
}

/// <summary>
/// Creates a default instance of the EdgeDriverService using a specified path to the EdgeDriver executable.
/// </summary>
/// <param name="driverPath">The directory containing the EdgeDriver executable.</param>
/// <returns>A EdgeDriverService using a random port.</returns>
public static EdgeDriverService CreateDefaultService(string driverPath)
{
return CreateDefaultService(driverPath, MicrosoftWebDriverServiceFileName);
}

/// <summary>
/// Creates a default instance of the EdgeDriverService using a specified path to the EdgeDriver executable with the given name.
/// </summary>
/// <param name="driverPath">The directory containing the EdgeDriver executable.</param>
/// <param name="driverExecutableFileName">The name of the EdgeDriver executable file.</param>
/// <returns>A EdgeDriverService using a random port.</returns>
public static EdgeDriverService CreateDefaultService(string driverPath, string driverExecutableFileName)
{
return new EdgeDriverService(driverPath, driverExecutableFileName, PortUtilities.FindFreePort());
}

/// <summary>
/// Creates a default instance of the EdgeDriverService using a specified path to the EdgeDriver executable with the given name and listening port.
/// </summary>
/// <param name="driverPath">The directory containing the EdgeDriver executable.</param>
/// <param name="driverExecutableFileName">The name of the EdgeDriver executable file</param>
/// <param name="port">The port number on which the driver will listen</param>
/// <returns></returns>
public static EdgeDriverService CreateDefaultService(string driverPath, string driverExecutableFileName, int port)
{
return new EdgeDriverService(driverPath, driverExecutableFileName, port);
}
}
}
Loading

0 comments on commit 9ed9272

Please sign in to comment.