-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: additional capabilities (#131)
Additional capabilities are often required to support the use of managed Selenium Grid services (e.g. account details are often passed this way). Consumers using their own Selenium Grids may also see some benefits to being able to pass these as well.
- Loading branch information
Showing
4 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
bindings/src/Capgemini.PowerApps.SpecFlowBindings/Extensions/DriverOptionsExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
namespace Capgemini.PowerApps.SpecFlowBindings.Extensions | ||
{ | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium.Chrome; | ||
using OpenQA.Selenium.Firefox; | ||
using OpenQA.Selenium.IE; | ||
|
||
/// <summary> | ||
/// Extensions to the <see cref="DriverOptions"/> class. | ||
/// </summary> | ||
public static class DriverOptionsExtensions | ||
{ | ||
/// <summary> | ||
/// Adds a global capability to driver options. | ||
/// </summary> | ||
/// <param name="options">The driver options.</param> | ||
/// <param name="name">The name of the capability.</param> | ||
/// <param name="value">The value of the capability.</param> | ||
internal static void AddGlobalCapability(this DriverOptions options, string name, object value) | ||
{ | ||
switch (options) | ||
{ | ||
case ChromeOptions chromeOptions: | ||
chromeOptions.AddAdditionalCapability(name, value, true); | ||
break; | ||
case FirefoxOptions firefoxOptions: | ||
firefoxOptions.AddAdditionalCapability(name, value, true); | ||
break; | ||
case InternetExplorerOptions internetExplorerOptions: | ||
internetExplorerOptions.AddAdditionalCapability(name, value, true); | ||
break; | ||
default: | ||
options.AddAdditionalCapability(name, value); | ||
break; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters