diff --git a/lib/PuppeteerSharp.Nunit/TestExpectations/TestExpectations.local.json b/lib/PuppeteerSharp.Nunit/TestExpectations/TestExpectations.local.json index cfe6877c4..02df38a38 100644 --- a/lib/PuppeteerSharp.Nunit/TestExpectations/TestExpectations.local.json +++ b/lib/PuppeteerSharp.Nunit/TestExpectations/TestExpectations.local.json @@ -1522,21 +1522,6 @@ "FAIL" ] }, - { - "comment": "This is part of organizing the webdriver bidi implementation, We will remove it one by one", - "testIdPattern": "[page.spec] *Page.setContent*", - "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": "[proxy.spec] *", diff --git a/lib/PuppeteerSharp.Tests/PageTests/SetContentTests.cs b/lib/PuppeteerSharp.Tests/PageTests/SetContentTests.cs index 3c186af30..efd10544e 100644 --- a/lib/PuppeteerSharp.Tests/PageTests/SetContentTests.cs +++ b/lib/PuppeteerSharp.Tests/PageTests/SetContentTests.cs @@ -7,7 +7,7 @@ namespace PuppeteerSharp.Tests.PageTests { public class SetContentTests : PuppeteerPageBaseTest { - const string ExpectedOutput = "
hello
"; + private const string ExpectedOutput = "
hello
"; public async Task Usage(IBrowser browser) { @@ -65,7 +65,7 @@ public async Task ShouldRespectTimeout() Timeout = 1 })); - Assert.That(exception.Message, Does.Contain("Timeout of 1 ms exceeded")); + Assert.That(exception!.Message, Does.Contain("Timeout of 1 ms exceeded")); } [Test, PuppeteerTest("page.spec", "Page Page.setContent", "should respect default navigation timeout")] @@ -79,7 +79,7 @@ public async Task ShouldRespectDefaultTimeout() var exception = Assert.ThrowsAsync(async () => await Page.SetContentAsync($"")); - Assert.That(exception.Message, Does.Contain("Timeout of 1 ms exceeded")); + Assert.That(exception!.Message, Does.Contain("Timeout of 1 ms exceeded")); } [Test, PuppeteerTest("page.spec", "Page Page.setContent", "should await resources to load")] diff --git a/lib/PuppeteerSharp.Tests/PuppeteerBrowserBaseTest.cs b/lib/PuppeteerSharp.Tests/PuppeteerBrowserBaseTest.cs index 5395435c2..aa94988f3 100644 --- a/lib/PuppeteerSharp.Tests/PuppeteerBrowserBaseTest.cs +++ b/lib/PuppeteerSharp.Tests/PuppeteerBrowserBaseTest.cs @@ -18,9 +18,16 @@ public async Task InitializeAsync() [TearDown] public async Task TearDownAsync() { - if (Browser is not null) + try { - await Browser.DisposeAsync(); + if (Browser is not null) + { + await Browser.DisposeAsync(); + } + } + catch + { + // Ignore exceptions during browser disposal } } } diff --git a/lib/PuppeteerSharp/Bidi/BidiElementHandle.cs b/lib/PuppeteerSharp/Bidi/BidiElementHandle.cs index b3fb070ac..70d6a738a 100644 --- a/lib/PuppeteerSharp/Bidi/BidiElementHandle.cs +++ b/lib/PuppeteerSharp/Bidi/BidiElementHandle.cs @@ -21,7 +21,6 @@ // * SOFTWARE. using System.Threading.Tasks; -using PuppeteerSharp.Cdp.Messaging; using PuppeteerSharp.QueryHandlers; using WebDriverBiDi.Script; @@ -40,15 +39,15 @@ internal class BidiElementHandle(RemoteValue value, BidiRealm realm) : ElementHa internal override CustomQuerySelectorRegistry CustomQuerySelectorRegistry { get; } = new(); - protected override Page Page { get; } + internal BidiFrame BidiFrame => realm.Environment as BidiFrame; + + protected override Page Page => BidiFrame.BidiPage; public static IJSHandle From(RemoteValue value, BidiRealm realm) { return new BidiElementHandle(value, realm); } - public override ValueTask DisposeAsync() => throw new System.NotImplementedException(); - public override Task UploadFileAsync(bool resolveFilePaths, params string[] filePaths) => throw new System.NotImplementedException(); public override Task