Skip to content

Commit

Permalink
Merge pull request #274 from q2ebanking/enhancement/BoaConstrictor-27…
Browse files Browse the repository at this point in the history
…3_CloseWebDriver

Enhancement/boa constrictor 273 close web driver
  • Loading branch information
pl-shernandez authored Jun 11, 2024
2 parents ce41918 + 6428a77 commit c47c8e7
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Boa.Constrictor.Selenium/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

(none)
### Added

- Added `CloseWebDriver` to `Boa.Constrictor.Screenplay` to enable closing the active window or tab


## [4.1.0] - 2024-01-29
Expand Down
49 changes: 49 additions & 0 deletions Boa.Constrictor.Selenium/Tasks/CloseWebDriver.cs
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
}
}
2 changes: 2 additions & 0 deletions Boa.Constrictor.Xunit/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ This file documents all notable changes to the Boa.Constrictor.Xunit project and
Its format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

## [Unreleased]

(none)

## [4.1.0] - 2024-04-15

### Added

- Added `MessageSinkLogger` for logging in xUnit extensibility classes
Expand Down

0 comments on commit c47c8e7

Please sign in to comment.