Skip to content

Commit

Permalink
Bidi: Pass browser target
Browse files Browse the repository at this point in the history
  • Loading branch information
kblok committed Dec 4, 2024
1 parent 986f673 commit 5a515de
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,6 @@
"FAIL"
]
},
{
"comment": "This is part of organizing the webdriver bidi implementation, We will remove it one by one",
"testIdPattern": "[browser.spec] *Browser.target*",
"platforms": [
"darwin",
"linux",
"win32"
],
"parameters": [
"webDriverBiDi"
],
"expectations": [
"FAIL"
]
},
{
"comment": "This is part of organizing the webdriver bidi implementation, We will remove it one by one",
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation*",
Expand Down
4 changes: 0 additions & 4 deletions lib/PuppeteerSharp.Tests/BrowserTests/TargetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ namespace PuppeteerSharp.Tests.BrowserTests
{
public class TargetTests : PuppeteerBrowserBaseTest
{
public TargetTests() : base()
{
}

[Test, Retry(2), PuppeteerTest("browser.spec", "Browser.target", "should return browser target")]
public void ShouldReturnBrowserTarget()
=> Assert.That(Browser.Target.Type, Is.EqualTo(TargetType.Browser));
Expand Down
3 changes: 3 additions & 0 deletions lib/PuppeteerSharp/Bidi/BidiBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ private BidiBrowser(Core.Browser browserCore, LaunchOptions options, ILoggerFact
/// <inheritdoc />
public override bool IsClosed { get; }

/// <inheritdoc />
public override ITarget Target => _target;

internal static string[] SubscribeModules { get; } =
[
"browsingContext",
Expand Down
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/Bidi/BidiBrowserTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal class BidiBrowserTarget(BidiBrowser bidiBrowser) : Target
{
public override string Url { get; }

public override TargetType Type { get; }
public override TargetType Type => TargetType.Browser;

public override ITarget Opener { get; }

Expand Down
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/Browser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public abstract class Browser : IBrowser
public bool IsConnected => !Connection.IsClosed;

/// <inheritdoc/>
public ITarget Target => Targets().FirstOrDefault(t => t.Type == TargetType.Browser);
public virtual ITarget Target => Targets().FirstOrDefault(t => t.Type == TargetType.Browser);

internal TaskQueue ScreenshotTaskQueue { get; } = new();

Expand Down

0 comments on commit 5a515de

Please sign in to comment.