diff --git a/PuppeteerSharp.Dom.Tests/ClickTests/ClickTests.cs b/PuppeteerSharp.Dom.Tests/ClickTests/ClickTests.cs index 67444b5..9acc51d 100644 --- a/PuppeteerSharp.Dom.Tests/ClickTests/ClickTests.cs +++ b/PuppeteerSharp.Dom.Tests/ClickTests/ClickTests.cs @@ -96,8 +96,8 @@ public async Task ShouldSelectTheTextByTripleClicking() await Page.Keyboard.TypeAsync(expected); await Page.ClickAsync("textarea"); - await Page.ClickAsync("textarea", new ClickOptions { ClickCount = 2 }); - await Page.ClickAsync("textarea", new ClickOptions { ClickCount = 3 }); + await Page.ClickAsync("textarea", new ClickOptions { Count = 2 }); + await Page.ClickAsync("textarea", new ClickOptions { Count = 3 }); var actual = await Page.EvaluateFunctionAsync(@"() => { const textarea = document.querySelector('textarea'); @@ -187,7 +187,7 @@ await Page.EvaluateExpressionAsync(@"{ }); }"); var button = await Page.QuerySelectorAsync("button"); - await button.ClickAsync(new ClickOptions { ClickCount = 2 }); + await button.ClickAsync(new ClickOptions { Count = 2 }); Assert.True(await Page.EvaluateExpressionAsync("double")); Assert.Equal("Clicked", await Page.EvaluateExpressionAsync("result")); } diff --git a/PuppeteerSharp.Dom.Tests/FrameUtils.cs b/PuppeteerSharp.Dom.Tests/FrameUtils.cs index 0f7bd24..c36ea61 100644 --- a/PuppeteerSharp.Dom.Tests/FrameUtils.cs +++ b/PuppeteerSharp.Dom.Tests/FrameUtils.cs @@ -30,9 +30,12 @@ await page.EvaluateFunctionAsync(@"function detachFrame(frameId) { public static IEnumerable DumpFrames(IFrame frame, string indentation = "") { var description = indentation + Regex.Replace(frame.Url, @":\d{4}", ":"); - if (!string.IsNullOrEmpty(frame.Name)) +#pragma warning disable CS0618 // Type or member is obsolete + var name = frame.Name; +#pragma warning restore CS0618 // Type or member is obsolete + if (!string.IsNullOrEmpty(name)) { - description += $" ({frame.Name})"; + description += $" ({name})"; } var result = new List() { description }; foreach (var child in frame.ChildFrames) diff --git a/PuppeteerSharp.Dom.Tests/PuppeteerBrowserContextBaseTest.cs b/PuppeteerSharp.Dom.Tests/PuppeteerBrowserContextBaseTest.cs index 5c72e9a..687219a 100644 --- a/PuppeteerSharp.Dom.Tests/PuppeteerBrowserContextBaseTest.cs +++ b/PuppeteerSharp.Dom.Tests/PuppeteerBrowserContextBaseTest.cs @@ -15,7 +15,7 @@ public PuppeteerBrowserContextBaseTest(ITestOutputHelper output) : base(output) public override async Task InitializeAsync() { await base.InitializeAsync(); - Context = await Browser.CreateIncognitoBrowserContextAsync(); + Context = await Browser.CreateBrowserContextAsync(); } } } diff --git a/PuppeteerSharp.Dom.Tests/PuppeteerLoaderFixture.cs b/PuppeteerSharp.Dom.Tests/PuppeteerLoaderFixture.cs index 0d586fb..32d281d 100644 --- a/PuppeteerSharp.Dom.Tests/PuppeteerLoaderFixture.cs +++ b/PuppeteerSharp.Dom.Tests/PuppeteerLoaderFixture.cs @@ -21,7 +21,7 @@ public void Dispose() private async Task SetupAsync() { - using var browserFetcher = new BrowserFetcher(SupportedBrowser.Chrome); + var browserFetcher = new BrowserFetcher(SupportedBrowser.Chrome); var downloaderTask = browserFetcher.DownloadAsync(); Server = SimpleServer.Create(TestConstants.Port, TestUtils.FindParentDirectory("PuppeteerSharp.Dom.TestServer")); diff --git a/PuppeteerSharp.Dom.Tests/PuppeteerSharp.Dom.Tests.csproj b/PuppeteerSharp.Dom.Tests/PuppeteerSharp.Dom.Tests.csproj index 7c1bb72..cbfb9c0 100644 --- a/PuppeteerSharp.Dom.Tests/PuppeteerSharp.Dom.Tests.csproj +++ b/PuppeteerSharp.Dom.Tests/PuppeteerSharp.Dom.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/PuppeteerSharp.Dom.Tests/QuerySelectorTests/PageContextQuerySelectorTests.cs b/PuppeteerSharp.Dom.Tests/QuerySelectorTests/PageContextQuerySelectorTests.cs index 1addf84..3e22262 100644 --- a/PuppeteerSharp.Dom.Tests/QuerySelectorTests/PageContextQuerySelectorTests.cs +++ b/PuppeteerSharp.Dom.Tests/QuerySelectorTests/PageContextQuerySelectorTests.cs @@ -18,7 +18,7 @@ public static async Task Usage() { #region QuerySelector - using var browserFetcher = new BrowserFetcher(); + var browserFetcher = new BrowserFetcher(); await browserFetcher.DownloadAsync(); await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = true }); await using var page = await browser.NewPageAsync(); diff --git a/PuppeteerSharp.Dom.Tests/QuerySelectorTests/PageQuerySelectorAllTests.cs b/PuppeteerSharp.Dom.Tests/QuerySelectorTests/PageQuerySelectorAllTests.cs index eae6d19..4495938 100644 --- a/PuppeteerSharp.Dom.Tests/QuerySelectorTests/PageQuerySelectorAllTests.cs +++ b/PuppeteerSharp.Dom.Tests/QuerySelectorTests/PageQuerySelectorAllTests.cs @@ -19,7 +19,7 @@ public async Task Usage() { #region QuerySelectorAll - using var browserFetcher = new BrowserFetcher(); + var browserFetcher = new BrowserFetcher(); await browserFetcher.DownloadAsync(); await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = true }); await using var page = await browser.NewPageAsync(); diff --git a/PuppeteerSharp.Dom/DomHandle.cs b/PuppeteerSharp.Dom/DomHandle.cs index 274ac9e..a366cc7 100644 --- a/PuppeteerSharp.Dom/DomHandle.cs +++ b/PuppeteerSharp.Dom/DomHandle.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Threading.Tasks; using Newtonsoft.Json.Linq; -using PuppeteerSharp.Messaging; +using PuppeteerSharp.Cdp.Messaging; namespace PuppeteerSharp.Dom { diff --git a/PuppeteerSharp.Dom/HtmlElement.cs b/PuppeteerSharp.Dom/HtmlElement.cs index 6489c18..c32a075 100644 --- a/PuppeteerSharp.Dom/HtmlElement.cs +++ b/PuppeteerSharp.Dom/HtmlElement.cs @@ -103,7 +103,7 @@ public Task PressAsync(string key, PressOptions options = null) } /// - /// Scrolls element into view if needed, and then uses to hover over the center of the element. + /// Scrolls element into view if needed, and then uses to hover over the center of the element. /// /// Task which resolves when the element is successfully hovered public Task HoverAsync() @@ -118,7 +118,7 @@ public Task HoverAsync() } /// - /// Scrolls element into view if needed, and then uses to click in the center of the element. + /// Scrolls element into view if needed, and then uses to click in the center of the element. /// /// click options /// if the element is detached from DOM diff --git a/PuppeteerSharp.Dom/PageExtensions.cs b/PuppeteerSharp.Dom/PageExtensions.cs index ef09352..8a12dda 100644 --- a/PuppeteerSharp.Dom/PageExtensions.cs +++ b/PuppeteerSharp.Dom/PageExtensions.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using PuppeteerSharp.Cdp.Messaging; namespace PuppeteerSharp.Dom { @@ -26,10 +27,10 @@ public static T ToDomHandle(this IJSHandle jsHandle) var remoteObject = jsHandle.RemoteObject; // Types like FileList are of SubType other - if (remoteObject.Type == Messaging.RemoteObjectType.Object && - (remoteObject.Subtype == Messaging.RemoteObjectSubtype.Node || - remoteObject.Subtype == Messaging.RemoteObjectSubtype.Array || - remoteObject.Subtype == Messaging.RemoteObjectSubtype.Other)) + if (remoteObject.Type == RemoteObjectType.Object && + (remoteObject.Subtype == RemoteObjectSubtype.Node || + remoteObject.Subtype == RemoteObjectSubtype.Array || + remoteObject.Subtype == RemoteObjectSubtype.Other)) { return HtmlObjectFactory.CreateObject(remoteObject.ClassName, jsHandle); } diff --git a/PuppeteerSharp.Dom/PuppeteerSharp.Dom.CodeGen.Partial.cs b/PuppeteerSharp.Dom/PuppeteerSharp.Dom.CodeGen.Partial.cs index 904b706..e5b3eb2 100644 --- a/PuppeteerSharp.Dom/PuppeteerSharp.Dom.CodeGen.Partial.cs +++ b/PuppeteerSharp.Dom/PuppeteerSharp.Dom.CodeGen.Partial.cs @@ -5,8 +5,6 @@ using System.Reflection; using System.Threading; using System.Threading.Tasks; -using Microsoft.Extensions.Logging; -using PuppeteerSharp.Messaging; namespace PuppeteerSharp.Dom { diff --git a/PuppeteerSharp.Dom/PuppeteerSharp.Dom.csproj b/PuppeteerSharp.Dom/PuppeteerSharp.Dom.csproj index 77c6132..8121281 100644 --- a/PuppeteerSharp.Dom/PuppeteerSharp.Dom.csproj +++ b/PuppeteerSharp.Dom/PuppeteerSharp.Dom.csproj @@ -22,7 +22,7 @@ README.md PuppeteerSharp.Dom - Upgrade to PuppeteerSharp to 14.0 + Upgrade to PuppeteerSharp 18.0 4.0.0 embedded @@ -37,7 +37,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/README.md b/README.md index bd7bf9c..b80bf00 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Read/write to the DOM ```cs -using var browserFetcher = new BrowserFetcher(); +var browserFetcher = new BrowserFetcher(); await browserFetcher.DownloadAsync(); await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = true }); await using var page = await browser.NewPageAsync();