Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement/boa constrictor 273 close web driver #274

Merged
merged 4 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading