-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce41918
commit ec86533
Showing
1 changed file
with
49 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Boa.Constrictor.Screenplay; | ||
using OpenQA.Selenium; | ||
|
||
namespace Boa.Constrictor.Selenium | ||
{ | ||
/// <summary> | ||
/// Closes the WebDriver window or tab. | ||
/// </summary> | ||
public class CloseWebDriver : AbstractWebTask | ||
{ | ||
#region Constructors | ||
|
||
/// <summary> | ||
/// Private constructor. | ||
/// (Use static builder methods to construct.) | ||
/// </summary> | ||
private CloseWebDriver() { } | ||
|
||
#endregion | ||
|
||
#region Builder Methods | ||
|
||
/// <summary> | ||
/// Constructs the Task object. | ||
/// </summary> | ||
/// <returns></returns> | ||
public static CloseWebDriver ForBrowser() => new CloseWebDriver(); | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
/// <summary> | ||
/// Closes the WebDriver window or tab. | ||
/// WARNING: You must switch back to a valid window handle in order to continue execution | ||
/// </summary> | ||
/// <param name="actor">The Screenplay Actor.</param> | ||
/// <param name="driver">The WebDriver.</param> | ||
public override void PerformAs(IActor actor, IWebDriver driver) => driver.Close(); | ||
|
||
/// <summary> | ||
/// Returns a description of the Task. | ||
/// </summary> | ||
/// <returns></returns> | ||
public override string ToString() => "close the WebDriver window or tab"; | ||
|
||
#endregion | ||
} | ||
} |