Skip to content

[dotnet] [bidi] Add browsing context screencast support - #17941

Open
nvborisenko wants to merge 3 commits into
SeleniumHQ:trunkfrom
nvborisenko:bidi-screencast
Open

[dotnet] [bidi] Add browsing context screencast support#17941
nvborisenko wants to merge 3 commits into
SeleniumHQ:trunkfrom
nvborisenko:bidi-screencast

Conversation

@nvborisenko

Copy link
Copy Markdown
Member

StartSceencast
StopScreencast

💥 What does this PR do?

This pull request adds support for screencast functionality to the BiDi BrowsingContext in the .NET WebDriver. It introduces new APIs to start and stop screencasts, defines the necessary data structures, and includes a test to verify the new feature. The most important changes are grouped below:

Screencast Feature Implementation:

  • Added new public methods StartScreencastAsync and StopScreencastAsync to the BrowsingContext class, enabling clients to start and stop screencasts on a browsing context.
  • Introduced the Screencast type and related result/options/parameter types in new files: Screencast.cs, StartScreencast.cs, and StopScreencast.cs. These encapsulate screencast session management and options. [1] [2] [3]
  • Registered the new screencast commands (browsingContext.startScreencast, browsingContext.stopScreencast) and their parameters/results in BrowsingContextModule, and implemented the corresponding async methods. [1] [2] [3]
  • Updated the IBrowsingContextModule interface to include the new screencast methods.

Testing:

  • Added a test CanStartAndStopScreencast to verify the screencast start and stop functionality, currently ignored for Chrome and Edge due to lack of support.

🔧 Implementation Notes

Following existing pattern.

🔄 Types of changes

  • New feature (non-breaking change which adds functionality and tests!)

@selenium-ci selenium-ci added the C-dotnet .NET Bindings label Aug 23, 2026
@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Add BiDi BrowsingContext screencast APIs for .NET

✨ Enhancement 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Add BiDi commands and .NET APIs to start/stop browsing-context screencasts.
• Introduce strongly-typed screencast handle plus options/results for session control.
• Add an integration test for start/stop (ignored on Chrome/Edge pending support).
Diagram

graph TD
  A(["Client code"]) --> B(["BrowsingContext API"]) --> C[["BrowsingContextModule"]] --> D(["BiDi ExecuteAsync"]) --> E{{"Browser (BiDi)"}}
  B --> F[("Screencast handle")]
  F --> C

  subgraph Legend
    direction LR
    _api(["Public API"]) ~~~ _mod[["Module/Command"]] ~~~ _db[("Handle/ID")] ~~~ _ext{{"External"}}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use string-based screencast id instead of Screencast type
  • ➕ Less public surface area and fewer types
  • ➕ Avoids carrying IBiDi reference inside the handle
  • ➖ Worse ergonomics (callers must thread ids around)
  • ➖ Easier to misuse across sessions; less type safety
2. Expose StopScreencastAsync on BrowsingContext as a convenience overload
  • ➕ More discoverable stop API (symmetry with StartScreencastAsync)
  • ➕ Callers don’t need to learn Screencast.StopAsync pattern
  • ➖ Adds additional public overloads to maintain
  • ➖ Encourages using context even when handle-centric API is cleaner

Recommendation: The chosen approach (strongly-typed Screencast handle with StopAsync plus module-level stop command) matches existing BiDi patterns and provides good ergonomics/type-safety. Consider optionally adding a BrowsingContext.StopScreencastAsync(Screencast) convenience overload if API discoverability becomes a concern, but it’s not required for correctness.

Files changed (7) +183 / -0

Enhancement (6) +167 / -0
BrowsingContext.csExpose StartScreencastAsync on BrowsingContext +5/-0

Expose StartScreencastAsync on BrowsingContext

• Adds a public StartScreencastAsync method that delegates to the BiDi BrowsingContext module implementation. Stop is intentionally modeled via the returned Screencast handle rather than a context method.

dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs

BrowsingContextModule.csRegister and execute start/stop screencast BiDi commands +24/-0

Register and execute start/stop screencast BiDi commands

• Introduces command registrations for browsingContext.startScreencast and browsingContext.stopScreencast and implements corresponding async methods. Updates source-generated JSON serialization metadata to include new parameter/result types.

dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs

IBrowsingContextModule.csAdd screencast methods to module interface +2/-0

Add screencast methods to module interface

• Extends IBrowsingContextModule with StartScreencastAsync and StopScreencastAsync to expose the new command surface through the module abstraction.

dotnet/src/webdriver/BiDi/BrowsingContext/IBrowsingContextModule.cs

Screencast.csAdd Screencast identifiable handle with StopAsync +68/-0

Add Screencast identifiable handle with StopAsync

• Adds a strongly-typed Screencast record implementing IIdentifiable, including JSON conversion support and equality semantics by Id. Provides a StopAsync convenience method that delegates to the module’s stop command.

dotnet/src/webdriver/BiDi/BrowsingContext/Screencast.cs

StartScreencast.csDefine start screencast parameters, options, and result types +42/-0

Define start screencast parameters, options, and result types

• Introduces StartScreencastParameters plus a public StartScreencastOptions record supporting mime type, video constraints, and audio toggle. Defines MediaTrackConstraints and StartScreencastResult returning the screencast handle and output path.

dotnet/src/webdriver/BiDi/BrowsingContext/StartScreencast.cs

StopScreencast.csDefine stop screencast parameters, options, and result types +26/-0

Define stop screencast parameters, options, and result types

• Adds StopScreencastParameters and public StopScreencastOptions, plus StopScreencastResult that returns the output path and an optional error string from the remote end.

dotnet/src/webdriver/BiDi/BrowsingContext/StopScreencast.cs

Tests (1) +16 / -0
BrowsingContextTests.csAdd start/stop screencast test (ignored on Chrome/Edge) +16/-0

Add start/stop screencast test (ignored on Chrome/Edge)

• Adds CanStartAndStopScreencast verifying that start returns a handle/path and stop returns the same path with no error. The test is ignored on Chrome and Edge due to current lack of support.

dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs

@qodo-code-review

qodo-code-review Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📜 Skill insights (0)

Grey Divider


Action required

1. Flaky screencast test skips ✗ Dismissed 🐞 Bug ☼ Reliability
Description
The new CanStartAndStopScreencast test is only ignored for Chrome and Edge, but Selenium’s own BiDi
integration coverage documents startScreencast as unsupported on Safari and failing on Firefox on
Linux. This will likely make the .NET test suite fail/flake on those environments.
Code

dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[R346-349]

+    [IgnoreBrowser(Infrastructure.Browser.Chrome, "Not supported yet?")]
+    [IgnoreBrowser(Infrastructure.Browser.Edge, "Not supported yet?")]
+    public async Task CanStartAndStopScreencast()
+    {
Evidence
The .NET test is only ignored for Chrome/Edge, while Selenium’s BiDi integration expectations in
this repo explicitly call out Safari as not implementing the command and Firefox-on-Linux as
failing, indicating the test will not be reliable across the project’s supported environments.

dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[345-359]
rb/spec/integration/selenium/webdriver/bidi/protocol/browsing_context_spec.rb[345-372]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`CanStartAndStopScreencast` is enabled for browsers/platforms where the command is known to be unsupported or known to fail, which can break CI.
## Issue Context
In this repo’s BiDi integration tests, `browsingContext.startScreencast` is marked pending/unsupported on Safari, and known to fail on Firefox on Linux.
## Fix Focus Areas
- dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[345-359]
## Suggested fix
- Add `[IgnoreBrowser(Browser.Safari, "Safari does not implement browsingContext.startScreencast")]` to the test.
- Add a targeted skip for the known Firefox/Linux failure. Since `IgnoreBrowserAttribute` cannot be combined with platform, consider either:
- adding a small new attribute that supports browser+platform filtering (preferred), or
- as an interim, add `[IgnorePlatform("linux", "Firefox startScreencast fails on Linux")`] if your CI for this test runs only on Linux (note this skips for all browsers on Linux).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Screencast cleanup leaks on failure 📘 Rule violation ☼ Reliability
Description
The test records the screencast path only after StopAsync() completes, so an assertion failure
after startup or an exception during stopping leaves the screencast handle unavailable and only a
path eligible for deletion. The active screencast and its artifact can therefore remain, leaking
session resources and contaminating later test runs or the browser process.
Code

dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[R367-369]

+            if (Path.Exists(stopScreencastResult?.Path))
+            {
+                File.Delete(stopScreencastResult.Path);
Evidence
The test starts a screencast and receives its path before assertions or stopping, but initializes
and assigns stopScreencastResult only after awaiting StopAsync(), while finally conditionally
deletes only stopScreencastResult?.Path. If an assertion fails or stopping throws, assignment
never occurs; because the Screencast returned by startup is the handle whose StopAsync() sends
the stop command, losing that handle prevents both stopping the browser-side screencast and reliably
cleaning up its artifact.

AGENTS.md: Prefer Small Tests and Avoid Mocks That Misrepresent API Contracts: AGENTS.md: Prefer Small Tests and Avoid Mocks That Misrepresent API Contracts
dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[355-360]
dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[365-370]
dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[351-371]
dotnet/src/webdriver/BiDi/BrowsingContext/Screencast.cs[42-45]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `finally` block deletes only `stopScreencastResult?.Path`, and the stop result is assigned only after `StopAsync()` completes. If startup succeeds but a later assertion fails or `StopAsync()` throws, the screencast handle is unavailable, no stop command is sent, and the screencast and its output artifact can remain active and leak resources into subsequent tests or the browser process.
## Issue Context
The screencast path is returned by `StartScreencastAsync` at lines 355-358, while the current cleanup depends on successful completion of `StopAsync()` at line 360. Keep the `Screencast` returned by `StartScreencastAsync` in a variable outside the `try` block; in `finally`, if that handle exists and stopping has not completed, attempt to stop it before deleting the resulting file. Cleanup should handle failures during both stopping and assertions without masking the original test failure.
## Fix Focus Areas
- dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[353-371]
- dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[351-371]
- dotnet/src/webdriver/BiDi/BrowsingContext/Screencast.cs[42-45]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Screencast public types undocumented ✗ Dismissed 📘 Rule violation ✧ Quality
Description
Multiple new public screencast-related types and interface/API members were introduced without XML
documentation that includes a non-empty <summary>. This violates the public API documentation
requirement and degrades IntelliSense and generated API docs for consumers.
Code

dotnet/src/webdriver/BiDi/BrowsingContext/Screencast.cs[R27-30]

+[JsonConverter(typeof(Converter))]
+public sealed record Screencast : IIdentifiable
+{
+    public Screencast(IBiDi bidi, string id)
Evidence
PR Compliance ID 389245 requires XML <summary> documentation for all public members/types in the
diff. In the cited changes, the new public types (Screencast, StartScreencastOptions,
MediaTrackConstraints, StartScreencastResult, StopScreencastOptions, StopScreencastResult) are
declared without any preceding XML doc comment blocks with <summary>, and the public method
declarations StartScreencastAsync and StopScreencastAsync (including the added StartScreencastAsync
member specifically) likewise have no preceding /// <summary> documentation, demonstrating the rule
violation across both types and members.

Rule 389245: Require XML documentation with <summary> for all public API members
dotnet/src/webdriver/BiDi/BrowsingContext/Screencast.cs[27-45]
dotnet/src/webdriver/BiDi/BrowsingContext/StartScreencast.cs[24-42]
dotnet/src/webdriver/BiDi/BrowsingContext/StopScreencast.cs[24-26]
dotnet/src/webdriver/BiDi/BrowsingContext/IBrowsingContextModule.cs[49-50]
dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs[108-112]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
New public screencast-related API surface (types and members, including interface methods like `StartScreencastAsync`/`StopScreencastAsync`) was added without XML documentation blocks containing a non-empty `<summary>`, violating the public API documentation requirement.
## Issue Context
PR Compliance ID 389245 requires that all public members/types introduced in the diff include `///` XML documentation with a non-empty `<summary>` so the .NET binding public surface is properly discoverable via IntelliSense and complete in generated documentation.
## Fix Focus Areas
- dotnet/src/webdriver/BiDi/BrowsingContext/Screencast.cs[27-45]
- dotnet/src/webdriver/BiDi/BrowsingContext/StartScreencast.cs[24-42]
- dotnet/src/webdriver/BiDi/BrowsingContext/StopScreencast.cs[24-26]
- dotnet/src/webdriver/BiDi/BrowsingContext/IBrowsingContextModule.cs[49-50]
- dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs[108-112]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
Review mode: 🚀 Fast: This push is a small, localized test-only cleanup that changes exception-path cleanup behavior without touching production logic or high-risk areas.

Grey Divider

Tip of the day
💡 Did you know, you can hide the parts of a finding you never read, like the evidence or the agent prompt

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit e3ca8bc 🚀 Fast

Results up to commit 282a1d3 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Flaky screencast test skips ✗ Dismissed 🐞 Bug ☼ Reliability
Description
The new CanStartAndStopScreencast test is only ignored for Chrome and Edge, but Selenium’s own BiDi
integration coverage documents startScreencast as unsupported on Safari and failing on Firefox on
Linux. This will likely make the .NET test suite fail/flake on those environments.
Code

dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[R346-349]

+    [IgnoreBrowser(Infrastructure.Browser.Chrome, "Not supported yet?")]
+    [IgnoreBrowser(Infrastructure.Browser.Edge, "Not supported yet?")]
+    public async Task CanStartAndStopScreencast()
+    {
Evidence
The .NET test is only ignored for Chrome/Edge, while Selenium’s BiDi integration expectations in
this repo explicitly call out Safari as not implementing the command and Firefox-on-Linux as
failing, indicating the test will not be reliable across the project’s supported environments.

dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[345-359]
rb/spec/integration/selenium/webdriver/bidi/protocol/browsing_context_spec.rb[345-372]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`CanStartAndStopScreencast` is enabled for browsers/platforms where the command is known to be unsupported or known to fail, which can break CI.

## Issue Context
In this repo’s BiDi integration tests, `browsingContext.startScreencast` is marked pending/unsupported on Safari, and known to fail on Firefox on Linux.

## Fix Focus Areas
- dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[345-359]

## Suggested fix
- Add `[IgnoreBrowser(Browser.Safari, "Safari does not implement browsingContext.startScreencast")]` to the test.
- Add a targeted skip for the known Firefox/Linux failure. Since `IgnoreBrowserAttribute` cannot be combined with platform, consider either:
 - adding a small new attribute that supports browser+platform filtering (preferred), or
 - as an interim, add `[IgnorePlatform("linux", "Firefox startScreencast fails on Linux")`] if your CI for this test runs only on Linux (note this skips for all browsers on Linux).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
2. Screencast public types undocumented ✗ Dismissed 📘 Rule violation ✧ Quality
Description
Multiple new public screencast-related types and interface/API members were introduced without XML
documentation that includes a non-empty <summary>. This violates the public API documentation
requirement and degrades IntelliSense and generated API docs for consumers.
Code

dotnet/src/webdriver/BiDi/BrowsingContext/Screencast.cs[R27-30]

+[JsonConverter(typeof(Converter))]
+public sealed record Screencast : IIdentifiable
+{
+    public Screencast(IBiDi bidi, string id)
Evidence
PR Compliance ID 389245 requires XML <summary> documentation for all public members/types in the
diff. In the cited changes, the new public types (Screencast, StartScreencastOptions,
MediaTrackConstraints, StartScreencastResult, StopScreencastOptions, StopScreencastResult) are
declared without any preceding XML doc comment blocks with <summary>, and the public method
declarations StartScreencastAsync and StopScreencastAsync (including the added StartScreencastAsync
member specifically) likewise have no preceding /// <summary> documentation, demonstrating the rule
violation across both types and members.

Rule 389245: Require XML documentation with <summary> for all public API members
dotnet/src/webdriver/BiDi/BrowsingContext/Screencast.cs[27-45]
dotnet/src/webdriver/BiDi/BrowsingContext/StartScreencast.cs[24-42]
dotnet/src/webdriver/BiDi/BrowsingContext/StopScreencast.cs[24-26]
dotnet/src/webdriver/BiDi/BrowsingContext/IBrowsingContextModule.cs[49-50]
dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs[108-112]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
New public screencast-related API surface (types and members, including interface methods like `StartScreencastAsync`/`StopScreencastAsync`) was added without XML documentation blocks containing a non-empty `<summary>`, violating the public API documentation requirement.

## Issue Context
PR Compliance ID 389245 requires that all public members/types introduced in the diff include `///` XML documentation with a non-empty `<summary>` so the .NET binding public surface is properly discoverable via IntelliSense and complete in generated documentation.

## Fix Focus Areas
- dotnet/src/webdriver/BiDi/BrowsingContext/Screencast.cs[27-45]
- dotnet/src/webdriver/BiDi/BrowsingContext/StartScreencast.cs[24-42]
- dotnet/src/webdriver/BiDi/BrowsingContext/StopScreencast.cs[24-26]
- dotnet/src/webdriver/BiDi/BrowsingContext/IBrowsingContextModule.cs[49-50]
- dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs[108-112]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit de4ef46 🚀 Fast


🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Screencast cleanup leaks on failure 📘 Rule violation ☼ Reliability
Description
The test records the screencast path only after StopAsync() completes, so an assertion failure
after startup or an exception during stopping leaves the screencast handle unavailable and only a
path eligible for deletion. The active screencast and its artifact can therefore remain, leaking
session resources and contaminating later test runs or the browser process.
Code

dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[R367-369]

+            if (Path.Exists(stopScreencastResult?.Path))
+            {
+                File.Delete(stopScreencastResult.Path);
Evidence
The test starts a screencast and receives its path before assertions or stopping, but initializes
and assigns stopScreencastResult only after awaiting StopAsync(), while finally conditionally
deletes only stopScreencastResult?.Path. If an assertion fails or stopping throws, assignment
never occurs; because the Screencast returned by startup is the handle whose StopAsync() sends
the stop command, losing that handle prevents both stopping the browser-side screencast and reliably
cleaning up its artifact.

AGENTS.md: Prefer Small Tests and Avoid Mocks That Misrepresent API Contracts
dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[355-360]
dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[365-370]
dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[351-371]
dotnet/src/webdriver/BiDi/BrowsingContext/Screencast.cs[42-45]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `finally` block deletes only `stopScreencastResult?.Path`, and the stop result is assigned only after `StopAsync()` completes. If startup succeeds but a later assertion fails or `StopAsync()` throws, the screencast handle is unavailable, no stop command is sent, and the screencast and its output artifact can remain active and leak resources into subsequent tests or the browser process.

## Issue Context
The screencast path is returned by `StartScreencastAsync` at lines 355-358, while the current cleanup depends on successful completion of `StopAsync()` at line 360. Keep the `Screencast` returned by `StartScreencastAsync` in a variable outside the `try` block; in `finally`, if that handle exists and stopping has not completed, attempt to stop it before deleting the resulting file. Cleanup should handle failures during both stopping and assertions without masking the original test failure.

## Fix Focus Areas
- dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[353-371]
- dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[351-371]
- dotnet/src/webdriver/BiDi/BrowsingContext/Screencast.cs[42-45]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread dotnet/src/webdriver/BiDi/BrowsingContext/Screencast.cs
Comment thread dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs
@nvborisenko

Copy link
Copy Markdown
Member Author

Passing locally. So awaiting new FF version.

@nvborisenko

nvborisenko commented Aug 24, 2026

Copy link
Copy Markdown
Member Author

Awaiting #17923 (FF 154), then it should pass.

Comment thread dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs Outdated
Comment on lines +367 to +369
if (Path.Exists(stopScreencastResult?.Path))
{
File.Delete(stopScreencastResult.Path);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Screencast cleanup leaks on failure 📘 Rule violation ☼ Reliability

The test records the screencast path only after StopAsync() completes, so an assertion failure
after startup or an exception during stopping leaves the screencast handle unavailable and only a
path eligible for deletion. The active screencast and its artifact can therefore remain, leaking
session resources and contaminating later test runs or the browser process.
Agent Prompt
## Issue description
The `finally` block deletes only `stopScreencastResult?.Path`, and the stop result is assigned only after `StopAsync()` completes. If startup succeeds but a later assertion fails or `StopAsync()` throws, the screencast handle is unavailable, no stop command is sent, and the screencast and its output artifact can remain active and leak resources into subsequent tests or the browser process.

## Issue Context
The screencast path is returned by `StartScreencastAsync` at lines 355-358, while the current cleanup depends on successful completion of `StopAsync()` at line 360. Keep the `Screencast` returned by `StartScreencastAsync` in a variable outside the `try` block; in `finally`, if that handle exists and stopping has not completed, attempt to stop it before deleting the resulting file. Cleanup should handle failures during both stopping and assertions without masking the original test failure.

## Fix Focus Areas
- dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[353-371]
- dotnet/test/webdriver/BiDi/BrowsingContext/BrowsingContextTests.cs[351-371]
- dotnet/src/webdriver/BiDi/BrowsingContext/Screencast.cs[42-45]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relying on start screencast. Fixed.

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit de4ef46

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit e3ca8bc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-dotnet .NET Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants