diff --git a/src/Playwright.Tests/BrowserContextFetchTests.cs b/src/Playwright.Tests/BrowserContextFetchTests.cs index e00ef549..1d6038bc 100644 --- a/src/Playwright.Tests/BrowserContextFetchTests.cs +++ b/src/Playwright.Tests/BrowserContextFetchTests.cs @@ -354,7 +354,7 @@ public class BrowserContextFetchTests : PageTestEx using StreamReader reader = new(request.Body, System.Text.Encoding.UTF8); return (request.Method, request.Path, reader.ReadToEndAsync().GetAwaiter().GetResult()); }), - Context.APIRequest.HeadAsync(Server.Prefix + "/simple.json", new() { Method = "POST", DataString = "My request" }) + Context.APIRequest.HeadAsync(Server.Prefix + "/simple.json", new() { Method = "POST", Data = "My request" }) ); Assert.AreEqual("HEAD", requestMethod); Assert.AreEqual("My request", requestBody); diff --git a/src/Playwright.Tests/BrowserContextHarTests.cs b/src/Playwright.Tests/BrowserContextHarTests.cs index 262b65bd..1c42f5ec 100644 --- a/src/Playwright.Tests/BrowserContextHarTests.cs +++ b/src/Playwright.Tests/BrowserContextHarTests.cs @@ -121,7 +121,7 @@ public class BrowserContextHarTests : ContextTestEx { var path = TestUtils.GetAsset("har-fulfill.har"); - await Context.RouteFromHARAsync(path, new() { UrlString = "**/*.js" }); + await Context.RouteFromHARAsync(path, new() { Url = "**/*.js" }); var page = await Context.NewPageAsync(); await Context.RouteAsync("http://no.playwright/", async route => { diff --git a/src/Playwright.Tests/GlobalFetchTests.cs b/src/Playwright.Tests/GlobalFetchTests.cs index 0aa3e8a3..1bad4a75 100644 --- a/src/Playwright.Tests/GlobalFetchTests.cs +++ b/src/Playwright.Tests/GlobalFetchTests.cs @@ -237,7 +237,7 @@ public class GlobalFetchTests : PlaywrightTestEx public async Task ShouldHaveANiceToString() { var request = await Playwright.APIRequest.NewContextAsync(); - var response = await request.PostAsync(Server.EmptyPage, new() { DataString = "My post data", Headers = new Dictionary() { ["Content-Type"] = "application/json" } }); + var response = await request.PostAsync(Server.EmptyPage, new() { Data = "My post data", Headers = new Dictionary() { ["Content-Type"] = "application/json" } }); var str = response.ToString(); StringAssert.Contains("APIResponse: 200 OK", str); foreach (var header in response.HeadersArray) diff --git a/src/Playwright.Tests/Locator/LocatorQueryTests.cs b/src/Playwright.Tests/Locator/LocatorQueryTests.cs index 0bc9d593..3d5187e6 100644 --- a/src/Playwright.Tests/Locator/LocatorQueryTests.cs +++ b/src/Playwright.Tests/Locator/LocatorQueryTests.cs @@ -92,7 +92,7 @@ public class LocatorQueryTests : PageTestEx public async Task ShouldFilterByText2() { await Page.SetContentAsync("
foo hello world bar
"); - StringAssert.Contains(await Page.Locator("div", new() { HasTextString = "hello world" }).TextContentAsync(), "foo hello world bar"); + StringAssert.Contains(await Page.Locator("div", new() { HasText = "hello world" }).TextContentAsync(), "foo hello world bar"); } [PlaywrightTest("locator-query.spec.ts", "should filter by regex")] @@ -151,7 +151,7 @@ public class LocatorQueryTests : PageTestEx { await Page.GotoAsync(Server.EmptyPage); ILocator[] locators = new ILocator[] { - Page.Locator("button", new() { HasTextString = "Драматург" }), + Page.Locator("button", new() { HasText = "Драматург" }), Page.Locator("button", new() { HasTextRegex = new Regex("Драматург") }), Page.Locator("button", new() { Has = Page.Locator("text=Драматург") }), }; @@ -181,14 +181,14 @@ public class LocatorQueryTests : PageTestEx public async Task ShouldSupportLocatorFilter() { await Page.SetContentAsync("
hello
world
"); - await Expect(Page.Locator("div").Filter(new() { HasTextString = "hello" })).ToHaveCountAsync(1); - await Expect(Page.Locator("div", new() { HasTextString = "hello" }).Filter(new() { HasTextString = "hello" })).ToHaveCountAsync(1); - await Expect(Page.Locator("div", new() { HasTextString = "hello" }).Filter(new() { HasTextString = "world" })).ToHaveCountAsync(0); - await Expect(Page.Locator("section", new() { HasTextString = "hello" }).Filter(new() { HasTextString = "world" })).ToHaveCountAsync(1); + await Expect(Page.Locator("div").Filter(new() { HasText = "hello" })).ToHaveCountAsync(1); + await Expect(Page.Locator("div", new() { HasTextString = "hello" }).Filter(new() { HasText = "hello" })).ToHaveCountAsync(1); + await Expect(Page.Locator("div", new() { HasText = "hello" }).Filter(new() { HasTextString = "world" })).ToHaveCountAsync(0); + await Expect(Page.Locator("section", new() { HasText = "hello" }).Filter(new() { HasTextString = "world" })).ToHaveCountAsync(1); await Expect(Page.Locator("div").Filter(new() { HasTextString = "hello" }).Locator("span")).ToHaveCountAsync(1); - await Expect(Page.Locator("div").Filter(new() { Has = Page.Locator("span", new() { HasTextString = "world" }) })).ToHaveCountAsync(1); + await Expect(Page.Locator("div").Filter(new() { Has = Page.Locator("span", new() { HasText = "world" }) })).ToHaveCountAsync(1); await Expect(Page.Locator("div").Filter(new() { Has = Page.Locator("span") })).ToHaveCountAsync(2); - await Expect(Page.Locator("div").Filter(new() { Has = Page.Locator("span"), HasTextString = "world" })).ToHaveCountAsync(1); + await Expect(Page.Locator("div").Filter(new() { Has = Page.Locator("span"), HasText = "world" })).ToHaveCountAsync(1); } [PlaywrightTest("locator-query.spec.ts", "should enforce same frame for has:locator'")] diff --git a/src/Playwright.Tests/SelectorsRoleTests.cs b/src/Playwright.Tests/SelectorsRoleTests.cs index 9241bc52..202bf744 100644 --- a/src/Playwright.Tests/SelectorsRoleTests.cs +++ b/src/Playwright.Tests/SelectorsRoleTests.cs @@ -251,12 +251,12 @@ public class SelectorsRoleTests : PageTestEx Assert.AreEqual(await Page.GetByRole(AriaRole.Button, new() { NameRegex = new Regex("h.*o", RegexOptions.IgnoreCase) }).EvaluateAllAsync("els => els.map(e => e.outerHTML)"), new string[] { "
", "
" }); Assert.AreEqual(await Page.Locator("role=button[name=Hello][include-hidden]").EvaluateAllAsync("els => els.map(e => e.outerHTML)"), new string[] { "
", "
" }); - Assert.AreEqual(await Page.GetByRole(AriaRole.Button, new() { NameString = "Hello", IncludeHidden = true }).EvaluateAllAsync("els => els.map(e => e.outerHTML)"), new string[] { "
", "
" }); + Assert.AreEqual(await Page.GetByRole(AriaRole.Button, new() { Name = "Hello", IncludeHidden = true }).EvaluateAllAsync("els => els.map(e => e.outerHTML)"), new string[] { "
", "
" }); Assert.AreEqual(await Page.GetByRole(AriaRole.Button, new() { NameString = "hello", IncludeHidden = true }).EvaluateAllAsync("els => els.map(e => e.outerHTML)"), new string[] { "
", "
" }); Assert.AreEqual(await Page.Locator("role=button[name=Hello]").EvaluateAllAsync("els => els.map(e => e.outerHTML)"), new string[] { "
" }); Assert.AreEqual(await Page.Locator("role=button[name=123][include-hidden]").EvaluateAllAsync("els => els.map(e => e.outerHTML)"), new string[] { "
" }); - Assert.AreEqual(await Page.GetByRole(AriaRole.Button, new() { NameString = "123", IncludeHidden = true }).EvaluateAllAsync("els => els.map(e => e.outerHTML)"), new string[] { "
" }); + Assert.AreEqual(await Page.GetByRole(AriaRole.Button, new() { Name = "123", IncludeHidden = true }).EvaluateAllAsync("els => els.map(e => e.outerHTML)"), new string[] { "
" }); } diff --git a/src/Playwright/API/Generated/Options/APIRequestContextOptions.cs b/src/Playwright/API/Generated/Options/APIRequestContextOptions.cs index e23ef957..e7dc46ec 100644 --- a/src/Playwright/API/Generated/Options/APIRequestContextOptions.cs +++ b/src/Playwright/API/Generated/Options/APIRequestContextOptions.cs @@ -40,9 +40,10 @@ public class APIRequestContextOptions return; } - DataString = clone.DataString; + Data = clone.Data; DataByte = clone.DataByte; DataObject = clone.DataObject; + DataString = clone.DataString; FailOnStatusCode = clone.FailOnStatusCode; Form = clone.Form; Headers = clone.Headers; @@ -62,8 +63,8 @@ public class APIRequestContextOptions /// if not explicitly set. /// /// - [JsonPropertyName("dataString")] - public string? DataString { get; set; } + [JsonPropertyName("data")] + public string? Data { get; set; } /// /// @@ -87,6 +88,17 @@ public class APIRequestContextOptions [JsonPropertyName("dataObject")] public object? DataObject { get; set; } + /// + /// + /// Allows to set post data of the request. If the data parameter is an object, it will + /// be serialized to json string and content-type header will be set to application/json + /// if not explicitly set. Otherwise the content-type header will be set to application/octet-stream + /// if not explicitly set. + /// + /// + [JsonPropertyName("dataString")] + public string? DataString { get; set; } + /// /// /// Whether to throw on response codes other than 2xx and 3xx. By default response object diff --git a/src/Playwright/API/Generated/Options/BrowserContextRouteFromHAROptions.cs b/src/Playwright/API/Generated/Options/BrowserContextRouteFromHAROptions.cs index fe304675..1b841dd3 100644 --- a/src/Playwright/API/Generated/Options/BrowserContextRouteFromHAROptions.cs +++ b/src/Playwright/API/Generated/Options/BrowserContextRouteFromHAROptions.cs @@ -42,8 +42,9 @@ public class BrowserContextRouteFromHAROptions NotFound = clone.NotFound; Update = clone.Update; - UrlString = clone.UrlString; + Url = clone.Url; UrlRegex = clone.UrlRegex; + UrlString = clone.UrlString; } /// @@ -73,8 +74,8 @@ public class BrowserContextRouteFromHAROptions /// all requests are served from the HAR file. /// /// - [JsonPropertyName("urlString")] - public string? UrlString { get; set; } + [JsonPropertyName("url")] + public string? Url { get; set; } /// /// @@ -85,6 +86,16 @@ public class BrowserContextRouteFromHAROptions /// [JsonPropertyName("urlRegex")] public Regex? UrlRegex { get; set; } + + /// + /// + /// A glob pattern, regular expression or predicate to match the request URL. Only requests + /// with URL matching the pattern will be served from the HAR file. If not specified, + /// all requests are served from the HAR file. + /// + /// + [JsonPropertyName("urlString")] + public string? UrlString { get; set; } } #nullable disable diff --git a/src/Playwright/API/Generated/Options/BrowserNewContextOptions.cs b/src/Playwright/API/Generated/Options/BrowserNewContextOptions.cs index 4d76182b..7a50b73c 100644 --- a/src/Playwright/API/Generated/Options/BrowserNewContextOptions.cs +++ b/src/Playwright/API/Generated/Options/BrowserNewContextOptions.cs @@ -62,8 +62,9 @@ public class BrowserNewContextOptions RecordHarMode = clone.RecordHarMode; RecordHarOmitContent = clone.RecordHarOmitContent; RecordHarPath = clone.RecordHarPath; - RecordHarUrlFilterString = clone.RecordHarUrlFilterString; + RecordHarUrlFilter = clone.RecordHarUrlFilter; RecordHarUrlFilterRegex = clone.RecordHarUrlFilterRegex; + RecordHarUrlFilterString = clone.RecordHarUrlFilterString; RecordVideoDir = clone.RecordVideoDir; RecordVideoSize = clone.RecordVideoSize; ReducedMotion = clone.ReducedMotion; @@ -253,12 +254,15 @@ public class BrowserNewContextOptions [JsonPropertyName("recordHarPath")] public string? RecordHarPath { get; set; } - [JsonPropertyName("recordHarUrlFilterString")] - public string? RecordHarUrlFilterString { get; set; } + [JsonPropertyName("recordHarUrlFilter")] + public string? RecordHarUrlFilter { get; set; } [JsonPropertyName("recordHarUrlFilterRegex")] public Regex? RecordHarUrlFilterRegex { get; set; } + [JsonPropertyName("recordHarUrlFilterString")] + public string? RecordHarUrlFilterString { get; set; } + /// /// /// Enables video recording for all pages into the specified directory. If not specified diff --git a/src/Playwright/API/Generated/Options/BrowserNewPageOptions.cs b/src/Playwright/API/Generated/Options/BrowserNewPageOptions.cs index fa61d8f7..c72a21e6 100644 --- a/src/Playwright/API/Generated/Options/BrowserNewPageOptions.cs +++ b/src/Playwright/API/Generated/Options/BrowserNewPageOptions.cs @@ -62,8 +62,9 @@ public class BrowserNewPageOptions RecordHarMode = clone.RecordHarMode; RecordHarOmitContent = clone.RecordHarOmitContent; RecordHarPath = clone.RecordHarPath; - RecordHarUrlFilterString = clone.RecordHarUrlFilterString; + RecordHarUrlFilter = clone.RecordHarUrlFilter; RecordHarUrlFilterRegex = clone.RecordHarUrlFilterRegex; + RecordHarUrlFilterString = clone.RecordHarUrlFilterString; RecordVideoDir = clone.RecordVideoDir; RecordVideoSize = clone.RecordVideoSize; ReducedMotion = clone.ReducedMotion; @@ -253,12 +254,15 @@ public class BrowserNewPageOptions [JsonPropertyName("recordHarPath")] public string? RecordHarPath { get; set; } - [JsonPropertyName("recordHarUrlFilterString")] - public string? RecordHarUrlFilterString { get; set; } + [JsonPropertyName("recordHarUrlFilter")] + public string? RecordHarUrlFilter { get; set; } [JsonPropertyName("recordHarUrlFilterRegex")] public Regex? RecordHarUrlFilterRegex { get; set; } + [JsonPropertyName("recordHarUrlFilterString")] + public string? RecordHarUrlFilterString { get; set; } + /// /// /// Enables video recording for all pages into the specified directory. If not specified diff --git a/src/Playwright/API/Generated/Options/BrowserTypeLaunchPersistentContextOptions.cs b/src/Playwright/API/Generated/Options/BrowserTypeLaunchPersistentContextOptions.cs index d75673c6..103189be 100644 --- a/src/Playwright/API/Generated/Options/BrowserTypeLaunchPersistentContextOptions.cs +++ b/src/Playwright/API/Generated/Options/BrowserTypeLaunchPersistentContextOptions.cs @@ -75,8 +75,9 @@ public class BrowserTypeLaunchPersistentContextOptions RecordHarMode = clone.RecordHarMode; RecordHarOmitContent = clone.RecordHarOmitContent; RecordHarPath = clone.RecordHarPath; - RecordHarUrlFilterString = clone.RecordHarUrlFilterString; + RecordHarUrlFilter = clone.RecordHarUrlFilter; RecordHarUrlFilterRegex = clone.RecordHarUrlFilterRegex; + RecordHarUrlFilterString = clone.RecordHarUrlFilterString; RecordVideoDir = clone.RecordVideoDir; RecordVideoSize = clone.RecordVideoSize; ReducedMotion = clone.ReducedMotion; @@ -359,12 +360,15 @@ public class BrowserTypeLaunchPersistentContextOptions [JsonPropertyName("recordHarPath")] public string? RecordHarPath { get; set; } - [JsonPropertyName("recordHarUrlFilterString")] - public string? RecordHarUrlFilterString { get; set; } + [JsonPropertyName("recordHarUrlFilter")] + public string? RecordHarUrlFilter { get; set; } [JsonPropertyName("recordHarUrlFilterRegex")] public Regex? RecordHarUrlFilterRegex { get; set; } + [JsonPropertyName("recordHarUrlFilterString")] + public string? RecordHarUrlFilterString { get; set; } + /// /// /// Enables video recording for all pages into the specified directory. If not specified diff --git a/src/Playwright/API/Generated/Options/FrameGetByRoleOptions.cs b/src/Playwright/API/Generated/Options/FrameGetByRoleOptions.cs index c4d6cc18..1355b5a3 100644 --- a/src/Playwright/API/Generated/Options/FrameGetByRoleOptions.cs +++ b/src/Playwright/API/Generated/Options/FrameGetByRoleOptions.cs @@ -42,11 +42,13 @@ public class FrameGetByRoleOptions Checked = clone.Checked; Disabled = clone.Disabled; + Exact = clone.Exact; Expanded = clone.Expanded; IncludeHidden = clone.IncludeHidden; Level = clone.Level; - NameString = clone.NameString; + Name = clone.Name; NameRegex = clone.NameRegex; + NameString = clone.NameString; Pressed = clone.Pressed; Selected = clone.Selected; } @@ -54,14 +56,14 @@ public class FrameGetByRoleOptions /// /// /// An attribute that is usually set by aria-checked or native <input type=checkbox> - /// controls. Available values for checked are true, false and "mixed". + /// controls. /// /// Learn more about aria-checked. /// [JsonPropertyName("checked")] public bool? Checked { get; set; } - /// A boolean attribute that is usually set by aria-disabled or disabled. + /// An attribute that is usually set by aria-disabled or disabled. /// /// /// Unlike most other attributes, disabled is inherited through the DOM hierarchy. @@ -72,7 +74,17 @@ public class FrameGetByRoleOptions public bool? Disabled { get; set; } /// - /// A boolean attribute that is usually set by aria-expanded. + /// + /// Whether is matched exactly: case-sensitive and whole-string. + /// Defaults to false. Ignored when is a regular expression. + /// Note that exact match still trims whitespace. + /// + /// + [JsonPropertyName("exact")] + public bool? Exact { get; set; } + + /// + /// An attribute that is usually set by aria-expanded. /// Learn more about aria-expanded. /// [JsonPropertyName("expanded")] @@ -80,8 +92,8 @@ public class FrameGetByRoleOptions /// /// - /// A boolean attribute that controls whether hidden elements are matched. By default, - /// only non-hidden elements, as defined + /// Option that controls whether hidden elements are matched. By default, only non-hidden + /// elements, as defined /// by ARIA, are matched by role selector. /// /// Learn more about aria-hidden. @@ -102,21 +114,23 @@ public class FrameGetByRoleOptions /// /// - /// A string attribute that matches accessible - /// name. + /// Option to match the accessible + /// name. By default, matching is case-insensitive and searches for a substring, + /// use to control this behavior. /// /// /// Learn more about accessible /// name. /// /// - [JsonPropertyName("nameString")] - public string? NameString { get; set; } + [JsonPropertyName("name")] + public string? Name { get; set; } /// /// - /// A string attribute that matches accessible - /// name. + /// Option to match the accessible + /// name. By default, matching is case-insensitive and searches for a substring, + /// use to control this behavior. /// /// /// Learn more about accessible @@ -128,16 +142,27 @@ public class FrameGetByRoleOptions /// /// - /// An attribute that is usually set by aria-pressed. Available values for pressed - /// are true, false and "mixed". + /// Option to match the accessible + /// name. By default, matching is case-insensitive and searches for a substring, + /// use to control this behavior. /// + /// + /// Learn more about accessible + /// name. + /// + /// + [JsonPropertyName("nameString")] + public string? NameString { get; set; } + + /// + /// An attribute that is usually set by aria-pressed. /// Learn more about aria-pressed. /// [JsonPropertyName("pressed")] public bool? Pressed { get; set; } /// - /// A boolean attribute that is usually set by aria-selected. + /// An attribute that is usually set by aria-selected. /// Learn more about aria-selected. /// [JsonPropertyName("selected")] diff --git a/src/Playwright/API/Generated/Options/FrameLocatorGetByRoleOptions.cs b/src/Playwright/API/Generated/Options/FrameLocatorGetByRoleOptions.cs index 5b1343e8..b631e547 100644 --- a/src/Playwright/API/Generated/Options/FrameLocatorGetByRoleOptions.cs +++ b/src/Playwright/API/Generated/Options/FrameLocatorGetByRoleOptions.cs @@ -42,11 +42,13 @@ public class FrameLocatorGetByRoleOptions Checked = clone.Checked; Disabled = clone.Disabled; + Exact = clone.Exact; Expanded = clone.Expanded; IncludeHidden = clone.IncludeHidden; Level = clone.Level; - NameString = clone.NameString; + Name = clone.Name; NameRegex = clone.NameRegex; + NameString = clone.NameString; Pressed = clone.Pressed; Selected = clone.Selected; } @@ -54,14 +56,14 @@ public class FrameLocatorGetByRoleOptions /// /// /// An attribute that is usually set by aria-checked or native <input type=checkbox> - /// controls. Available values for checked are true, false and "mixed". + /// controls. /// /// Learn more about aria-checked. /// [JsonPropertyName("checked")] public bool? Checked { get; set; } - /// A boolean attribute that is usually set by aria-disabled or disabled. + /// An attribute that is usually set by aria-disabled or disabled. /// /// /// Unlike most other attributes, disabled is inherited through the DOM hierarchy. @@ -72,7 +74,17 @@ public class FrameLocatorGetByRoleOptions public bool? Disabled { get; set; } /// - /// A boolean attribute that is usually set by aria-expanded. + /// + /// Whether is matched exactly: case-sensitive and whole-string. + /// Defaults to false. Ignored when is a regular expression. + /// Note that exact match still trims whitespace. + /// + /// + [JsonPropertyName("exact")] + public bool? Exact { get; set; } + + /// + /// An attribute that is usually set by aria-expanded. /// Learn more about aria-expanded. /// [JsonPropertyName("expanded")] @@ -80,8 +92,8 @@ public class FrameLocatorGetByRoleOptions /// /// - /// A boolean attribute that controls whether hidden elements are matched. By default, - /// only non-hidden elements, as defined + /// Option that controls whether hidden elements are matched. By default, only non-hidden + /// elements, as defined /// by ARIA, are matched by role selector. /// /// Learn more about aria-hidden. @@ -102,21 +114,23 @@ public class FrameLocatorGetByRoleOptions /// /// - /// A string attribute that matches accessible - /// name. + /// Option to match the accessible + /// name. By default, matching is case-insensitive and searches for a substring, + /// use to control this behavior. /// /// /// Learn more about accessible /// name. /// /// - [JsonPropertyName("nameString")] - public string? NameString { get; set; } + [JsonPropertyName("name")] + public string? Name { get; set; } /// /// - /// A string attribute that matches accessible - /// name. + /// Option to match the accessible + /// name. By default, matching is case-insensitive and searches for a substring, + /// use to control this behavior. /// /// /// Learn more about accessible @@ -128,16 +142,27 @@ public class FrameLocatorGetByRoleOptions /// /// - /// An attribute that is usually set by aria-pressed. Available values for pressed - /// are true, false and "mixed". + /// Option to match the accessible + /// name. By default, matching is case-insensitive and searches for a substring, + /// use to control this behavior. /// + /// + /// Learn more about accessible + /// name. + /// + /// + [JsonPropertyName("nameString")] + public string? NameString { get; set; } + + /// + /// An attribute that is usually set by aria-pressed. /// Learn more about aria-pressed. /// [JsonPropertyName("pressed")] public bool? Pressed { get; set; } /// - /// A boolean attribute that is usually set by aria-selected. + /// An attribute that is usually set by aria-selected. /// Learn more about aria-selected. /// [JsonPropertyName("selected")] diff --git a/src/Playwright/API/Generated/Options/FrameLocatorLocatorOptions.cs b/src/Playwright/API/Generated/Options/FrameLocatorLocatorOptions.cs index 62503789..7d26e38b 100644 --- a/src/Playwright/API/Generated/Options/FrameLocatorLocatorOptions.cs +++ b/src/Playwright/API/Generated/Options/FrameLocatorLocatorOptions.cs @@ -41,8 +41,9 @@ public class FrameLocatorLocatorOptions } Has = clone.Has; - HasTextString = clone.HasTextString; + HasText = clone.HasText; HasTextRegex = clone.HasTextRegex; + HasTextString = clone.HasTextString; } /// @@ -66,8 +67,8 @@ public class FrameLocatorLocatorOptions /// and searches for a substring. For example, "Playwright" matches <article><div>Playwright</div></article>. /// /// - [JsonPropertyName("hasTextString")] - public string? HasTextString { get; set; } + [JsonPropertyName("hasText")] + public string? HasText { get; set; } /// /// @@ -78,6 +79,16 @@ public class FrameLocatorLocatorOptions /// [JsonPropertyName("hasTextRegex")] public Regex? HasTextRegex { get; set; } + + /// + /// + /// Matches elements containing specified text somewhere inside, possibly in a child + /// or a descendant element. When passed a , matching is case-insensitive + /// and searches for a substring. For example, "Playwright" matches <article><div>Playwright</div></article>. + /// + /// + [JsonPropertyName("hasTextString")] + public string? HasTextString { get; set; } } #nullable disable diff --git a/src/Playwright/API/Generated/Options/FrameLocatorOptions.cs b/src/Playwright/API/Generated/Options/FrameLocatorOptions.cs index a2acafd8..bb94c38d 100644 --- a/src/Playwright/API/Generated/Options/FrameLocatorOptions.cs +++ b/src/Playwright/API/Generated/Options/FrameLocatorOptions.cs @@ -41,8 +41,9 @@ public class FrameLocatorOptions } Has = clone.Has; - HasTextString = clone.HasTextString; + HasText = clone.HasText; HasTextRegex = clone.HasTextRegex; + HasTextString = clone.HasTextString; } /// @@ -66,8 +67,8 @@ public class FrameLocatorOptions /// and searches for a substring. For example, "Playwright" matches <article><div>Playwright</div></article>. /// /// - [JsonPropertyName("hasTextString")] - public string? HasTextString { get; set; } + [JsonPropertyName("hasText")] + public string? HasText { get; set; } /// /// @@ -78,6 +79,16 @@ public class FrameLocatorOptions /// [JsonPropertyName("hasTextRegex")] public Regex? HasTextRegex { get; set; } + + /// + /// + /// Matches elements containing specified text somewhere inside, possibly in a child + /// or a descendant element. When passed a , matching is case-insensitive + /// and searches for a substring. For example, "Playwright" matches <article><div>Playwright</div></article>. + /// + /// + [JsonPropertyName("hasTextString")] + public string? HasTextString { get; set; } } #nullable disable diff --git a/src/Playwright/API/Generated/Options/FrameRunAndWaitForNavigationOptions.cs b/src/Playwright/API/Generated/Options/FrameRunAndWaitForNavigationOptions.cs index c987f500..cfbc1069 100644 --- a/src/Playwright/API/Generated/Options/FrameRunAndWaitForNavigationOptions.cs +++ b/src/Playwright/API/Generated/Options/FrameRunAndWaitForNavigationOptions.cs @@ -42,9 +42,10 @@ public class FrameRunAndWaitForNavigationOptions } Timeout = clone.Timeout; - UrlString = clone.UrlString; - UrlRegex = clone.UrlRegex; + Url = clone.Url; UrlFunc = clone.UrlFunc; + UrlRegex = clone.UrlRegex; + UrlString = clone.UrlString; WaitUntil = clone.WaitUntil; } @@ -67,8 +68,19 @@ public class FrameRunAndWaitForNavigationOptions /// equal to the string. /// /// - [JsonPropertyName("urlString")] - public string? UrlString { get; set; } + [JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// + /// A glob pattern, regex pattern or predicate receiving to match + /// while waiting for the navigation. Note that if the parameter is a string without + /// wildcard characters, the method will wait for navigation to URL that is exactly + /// equal to the string. + /// + /// + [JsonPropertyName("urlFunc")] + public Func? UrlFunc { get; set; } /// /// @@ -89,8 +101,8 @@ public class FrameRunAndWaitForNavigationOptions /// equal to the string. /// /// - [JsonPropertyName("urlFunc")] - public Func? UrlFunc { get; set; } + [JsonPropertyName("urlString")] + public string? UrlString { get; set; } /// /// When to consider operation succeeded, defaults to load. Events can be either: diff --git a/src/Playwright/API/Generated/Options/FrameWaitForNavigationOptions.cs b/src/Playwright/API/Generated/Options/FrameWaitForNavigationOptions.cs index a4933af2..03612ba0 100644 --- a/src/Playwright/API/Generated/Options/FrameWaitForNavigationOptions.cs +++ b/src/Playwright/API/Generated/Options/FrameWaitForNavigationOptions.cs @@ -42,9 +42,10 @@ public class FrameWaitForNavigationOptions } Timeout = clone.Timeout; - UrlString = clone.UrlString; - UrlRegex = clone.UrlRegex; + Url = clone.Url; UrlFunc = clone.UrlFunc; + UrlRegex = clone.UrlRegex; + UrlString = clone.UrlString; WaitUntil = clone.WaitUntil; } @@ -67,8 +68,19 @@ public class FrameWaitForNavigationOptions /// equal to the string. /// /// - [JsonPropertyName("urlString")] - public string? UrlString { get; set; } + [JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// + /// A glob pattern, regex pattern or predicate receiving to match + /// while waiting for the navigation. Note that if the parameter is a string without + /// wildcard characters, the method will wait for navigation to URL that is exactly + /// equal to the string. + /// + /// + [JsonPropertyName("urlFunc")] + public Func? UrlFunc { get; set; } /// /// @@ -89,8 +101,8 @@ public class FrameWaitForNavigationOptions /// equal to the string. /// /// - [JsonPropertyName("urlFunc")] - public Func? UrlFunc { get; set; } + [JsonPropertyName("urlString")] + public string? UrlString { get; set; } /// /// When to consider operation succeeded, defaults to load. Events can be either: diff --git a/src/Playwright/API/Generated/Options/LocatorFilterOptions.cs b/src/Playwright/API/Generated/Options/LocatorFilterOptions.cs index 192f525a..71b373d7 100644 --- a/src/Playwright/API/Generated/Options/LocatorFilterOptions.cs +++ b/src/Playwright/API/Generated/Options/LocatorFilterOptions.cs @@ -41,8 +41,9 @@ public class LocatorFilterOptions } Has = clone.Has; - HasTextString = clone.HasTextString; + HasText = clone.HasText; HasTextRegex = clone.HasTextRegex; + HasTextString = clone.HasTextString; } /// @@ -66,8 +67,8 @@ public class LocatorFilterOptions /// and searches for a substring. For example, "Playwright" matches <article><div>Playwright</div></article>. /// /// - [JsonPropertyName("hasTextString")] - public string? HasTextString { get; set; } + [JsonPropertyName("hasText")] + public string? HasText { get; set; } /// /// @@ -78,6 +79,16 @@ public class LocatorFilterOptions /// [JsonPropertyName("hasTextRegex")] public Regex? HasTextRegex { get; set; } + + /// + /// + /// Matches elements containing specified text somewhere inside, possibly in a child + /// or a descendant element. When passed a , matching is case-insensitive + /// and searches for a substring. For example, "Playwright" matches <article><div>Playwright</div></article>. + /// + /// + [JsonPropertyName("hasTextString")] + public string? HasTextString { get; set; } } #nullable disable diff --git a/src/Playwright/API/Generated/Options/LocatorGetByRoleOptions.cs b/src/Playwright/API/Generated/Options/LocatorGetByRoleOptions.cs index 790222df..a4d44cb4 100644 --- a/src/Playwright/API/Generated/Options/LocatorGetByRoleOptions.cs +++ b/src/Playwright/API/Generated/Options/LocatorGetByRoleOptions.cs @@ -42,11 +42,13 @@ public class LocatorGetByRoleOptions Checked = clone.Checked; Disabled = clone.Disabled; + Exact = clone.Exact; Expanded = clone.Expanded; IncludeHidden = clone.IncludeHidden; Level = clone.Level; - NameString = clone.NameString; + Name = clone.Name; NameRegex = clone.NameRegex; + NameString = clone.NameString; Pressed = clone.Pressed; Selected = clone.Selected; } @@ -54,14 +56,14 @@ public class LocatorGetByRoleOptions /// /// /// An attribute that is usually set by aria-checked or native <input type=checkbox> - /// controls. Available values for checked are true, false and "mixed". + /// controls. /// /// Learn more about aria-checked. /// [JsonPropertyName("checked")] public bool? Checked { get; set; } - /// A boolean attribute that is usually set by aria-disabled or disabled. + /// An attribute that is usually set by aria-disabled or disabled. /// /// /// Unlike most other attributes, disabled is inherited through the DOM hierarchy. @@ -72,7 +74,17 @@ public class LocatorGetByRoleOptions public bool? Disabled { get; set; } /// - /// A boolean attribute that is usually set by aria-expanded. + /// + /// Whether is matched exactly: case-sensitive and whole-string. + /// Defaults to false. Ignored when is a regular expression. + /// Note that exact match still trims whitespace. + /// + /// + [JsonPropertyName("exact")] + public bool? Exact { get; set; } + + /// + /// An attribute that is usually set by aria-expanded. /// Learn more about aria-expanded. /// [JsonPropertyName("expanded")] @@ -80,8 +92,8 @@ public class LocatorGetByRoleOptions /// /// - /// A boolean attribute that controls whether hidden elements are matched. By default, - /// only non-hidden elements, as defined + /// Option that controls whether hidden elements are matched. By default, only non-hidden + /// elements, as defined /// by ARIA, are matched by role selector. /// /// Learn more about aria-hidden. @@ -102,21 +114,23 @@ public class LocatorGetByRoleOptions /// /// - /// A string attribute that matches accessible - /// name. + /// Option to match the accessible + /// name. By default, matching is case-insensitive and searches for a substring, + /// use to control this behavior. /// /// /// Learn more about accessible /// name. /// /// - [JsonPropertyName("nameString")] - public string? NameString { get; set; } + [JsonPropertyName("name")] + public string? Name { get; set; } /// /// - /// A string attribute that matches accessible - /// name. + /// Option to match the accessible + /// name. By default, matching is case-insensitive and searches for a substring, + /// use to control this behavior. /// /// /// Learn more about accessible @@ -128,16 +142,27 @@ public class LocatorGetByRoleOptions /// /// - /// An attribute that is usually set by aria-pressed. Available values for pressed - /// are true, false and "mixed". + /// Option to match the accessible + /// name. By default, matching is case-insensitive and searches for a substring, + /// use to control this behavior. /// + /// + /// Learn more about accessible + /// name. + /// + /// + [JsonPropertyName("nameString")] + public string? NameString { get; set; } + + /// + /// An attribute that is usually set by aria-pressed. /// Learn more about aria-pressed. /// [JsonPropertyName("pressed")] public bool? Pressed { get; set; } /// - /// A boolean attribute that is usually set by aria-selected. + /// An attribute that is usually set by aria-selected. /// Learn more about aria-selected. /// [JsonPropertyName("selected")] diff --git a/src/Playwright/API/Generated/Options/LocatorLocatorOptions.cs b/src/Playwright/API/Generated/Options/LocatorLocatorOptions.cs index fd10cbf3..eead0565 100644 --- a/src/Playwright/API/Generated/Options/LocatorLocatorOptions.cs +++ b/src/Playwright/API/Generated/Options/LocatorLocatorOptions.cs @@ -41,8 +41,9 @@ public class LocatorLocatorOptions } Has = clone.Has; - HasTextString = clone.HasTextString; + HasText = clone.HasText; HasTextRegex = clone.HasTextRegex; + HasTextString = clone.HasTextString; } /// @@ -66,8 +67,8 @@ public class LocatorLocatorOptions /// and searches for a substring. For example, "Playwright" matches <article><div>Playwright</div></article>. /// /// - [JsonPropertyName("hasTextString")] - public string? HasTextString { get; set; } + [JsonPropertyName("hasText")] + public string? HasText { get; set; } /// /// @@ -78,6 +79,16 @@ public class LocatorLocatorOptions /// [JsonPropertyName("hasTextRegex")] public Regex? HasTextRegex { get; set; } + + /// + /// + /// Matches elements containing specified text somewhere inside, possibly in a child + /// or a descendant element. When passed a , matching is case-insensitive + /// and searches for a substring. For example, "Playwright" matches <article><div>Playwright</div></article>. + /// + /// + [JsonPropertyName("hasTextString")] + public string? HasTextString { get; set; } } #nullable disable diff --git a/src/Playwright/API/Generated/Options/PageGetByRoleOptions.cs b/src/Playwright/API/Generated/Options/PageGetByRoleOptions.cs index a2b8d8cf..bb246217 100644 --- a/src/Playwright/API/Generated/Options/PageGetByRoleOptions.cs +++ b/src/Playwright/API/Generated/Options/PageGetByRoleOptions.cs @@ -42,11 +42,13 @@ public class PageGetByRoleOptions Checked = clone.Checked; Disabled = clone.Disabled; + Exact = clone.Exact; Expanded = clone.Expanded; IncludeHidden = clone.IncludeHidden; Level = clone.Level; - NameString = clone.NameString; + Name = clone.Name; NameRegex = clone.NameRegex; + NameString = clone.NameString; Pressed = clone.Pressed; Selected = clone.Selected; } @@ -54,14 +56,14 @@ public class PageGetByRoleOptions /// /// /// An attribute that is usually set by aria-checked or native <input type=checkbox> - /// controls. Available values for checked are true, false and "mixed". + /// controls. /// /// Learn more about aria-checked. /// [JsonPropertyName("checked")] public bool? Checked { get; set; } - /// A boolean attribute that is usually set by aria-disabled or disabled. + /// An attribute that is usually set by aria-disabled or disabled. /// /// /// Unlike most other attributes, disabled is inherited through the DOM hierarchy. @@ -72,7 +74,17 @@ public class PageGetByRoleOptions public bool? Disabled { get; set; } /// - /// A boolean attribute that is usually set by aria-expanded. + /// + /// Whether is matched exactly: case-sensitive and whole-string. + /// Defaults to false. Ignored when is a regular expression. + /// Note that exact match still trims whitespace. + /// + /// + [JsonPropertyName("exact")] + public bool? Exact { get; set; } + + /// + /// An attribute that is usually set by aria-expanded. /// Learn more about aria-expanded. /// [JsonPropertyName("expanded")] @@ -80,8 +92,8 @@ public class PageGetByRoleOptions /// /// - /// A boolean attribute that controls whether hidden elements are matched. By default, - /// only non-hidden elements, as defined + /// Option that controls whether hidden elements are matched. By default, only non-hidden + /// elements, as defined /// by ARIA, are matched by role selector. /// /// Learn more about aria-hidden. @@ -102,21 +114,23 @@ public class PageGetByRoleOptions /// /// - /// A string attribute that matches accessible - /// name. + /// Option to match the accessible + /// name. By default, matching is case-insensitive and searches for a substring, + /// use to control this behavior. /// /// /// Learn more about accessible /// name. /// /// - [JsonPropertyName("nameString")] - public string? NameString { get; set; } + [JsonPropertyName("name")] + public string? Name { get; set; } /// /// - /// A string attribute that matches accessible - /// name. + /// Option to match the accessible + /// name. By default, matching is case-insensitive and searches for a substring, + /// use to control this behavior. /// /// /// Learn more about accessible @@ -128,16 +142,27 @@ public class PageGetByRoleOptions /// /// - /// An attribute that is usually set by aria-pressed. Available values for pressed - /// are true, false and "mixed". + /// Option to match the accessible + /// name. By default, matching is case-insensitive and searches for a substring, + /// use to control this behavior. /// + /// + /// Learn more about accessible + /// name. + /// + /// + [JsonPropertyName("nameString")] + public string? NameString { get; set; } + + /// + /// An attribute that is usually set by aria-pressed. /// Learn more about aria-pressed. /// [JsonPropertyName("pressed")] public bool? Pressed { get; set; } /// - /// A boolean attribute that is usually set by aria-selected. + /// An attribute that is usually set by aria-selected. /// Learn more about aria-selected. /// [JsonPropertyName("selected")] diff --git a/src/Playwright/API/Generated/Options/PageLocatorOptions.cs b/src/Playwright/API/Generated/Options/PageLocatorOptions.cs index c6f10791..6b7a7b0a 100644 --- a/src/Playwright/API/Generated/Options/PageLocatorOptions.cs +++ b/src/Playwright/API/Generated/Options/PageLocatorOptions.cs @@ -41,8 +41,9 @@ public class PageLocatorOptions } Has = clone.Has; - HasTextString = clone.HasTextString; + HasText = clone.HasText; HasTextRegex = clone.HasTextRegex; + HasTextString = clone.HasTextString; } /// @@ -66,8 +67,8 @@ public class PageLocatorOptions /// and searches for a substring. For example, "Playwright" matches <article><div>Playwright</div></article>. /// /// - [JsonPropertyName("hasTextString")] - public string? HasTextString { get; set; } + [JsonPropertyName("hasText")] + public string? HasText { get; set; } /// /// @@ -78,6 +79,16 @@ public class PageLocatorOptions /// [JsonPropertyName("hasTextRegex")] public Regex? HasTextRegex { get; set; } + + /// + /// + /// Matches elements containing specified text somewhere inside, possibly in a child + /// or a descendant element. When passed a , matching is case-insensitive + /// and searches for a substring. For example, "Playwright" matches <article><div>Playwright</div></article>. + /// + /// + [JsonPropertyName("hasTextString")] + public string? HasTextString { get; set; } } #nullable disable diff --git a/src/Playwright/API/Generated/Options/PageRouteFromHAROptions.cs b/src/Playwright/API/Generated/Options/PageRouteFromHAROptions.cs index af8b6f46..26152a8a 100644 --- a/src/Playwright/API/Generated/Options/PageRouteFromHAROptions.cs +++ b/src/Playwright/API/Generated/Options/PageRouteFromHAROptions.cs @@ -42,8 +42,9 @@ public class PageRouteFromHAROptions NotFound = clone.NotFound; Update = clone.Update; - UrlString = clone.UrlString; + Url = clone.Url; UrlRegex = clone.UrlRegex; + UrlString = clone.UrlString; } /// @@ -73,8 +74,8 @@ public class PageRouteFromHAROptions /// all requests are served from the HAR file. /// /// - [JsonPropertyName("urlString")] - public string? UrlString { get; set; } + [JsonPropertyName("url")] + public string? Url { get; set; } /// /// @@ -85,6 +86,16 @@ public class PageRouteFromHAROptions /// [JsonPropertyName("urlRegex")] public Regex? UrlRegex { get; set; } + + /// + /// + /// A glob pattern, regular expression or predicate to match the request URL. Only requests + /// with URL matching the pattern will be served from the HAR file. If not specified, + /// all requests are served from the HAR file. + /// + /// + [JsonPropertyName("urlString")] + public string? UrlString { get; set; } } #nullable disable diff --git a/src/Playwright/API/Generated/Options/PageRunAndWaitForNavigationOptions.cs b/src/Playwright/API/Generated/Options/PageRunAndWaitForNavigationOptions.cs index 82252f88..39630101 100644 --- a/src/Playwright/API/Generated/Options/PageRunAndWaitForNavigationOptions.cs +++ b/src/Playwright/API/Generated/Options/PageRunAndWaitForNavigationOptions.cs @@ -42,9 +42,10 @@ public class PageRunAndWaitForNavigationOptions } Timeout = clone.Timeout; - UrlString = clone.UrlString; - UrlRegex = clone.UrlRegex; + Url = clone.Url; UrlFunc = clone.UrlFunc; + UrlRegex = clone.UrlRegex; + UrlString = clone.UrlString; WaitUntil = clone.WaitUntil; } @@ -67,8 +68,19 @@ public class PageRunAndWaitForNavigationOptions /// equal to the string. /// /// - [JsonPropertyName("urlString")] - public string? UrlString { get; set; } + [JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// + /// A glob pattern, regex pattern or predicate receiving to match + /// while waiting for the navigation. Note that if the parameter is a string without + /// wildcard characters, the method will wait for navigation to URL that is exactly + /// equal to the string. + /// + /// + [JsonPropertyName("urlFunc")] + public Func? UrlFunc { get; set; } /// /// @@ -89,8 +101,8 @@ public class PageRunAndWaitForNavigationOptions /// equal to the string. /// /// - [JsonPropertyName("urlFunc")] - public Func? UrlFunc { get; set; } + [JsonPropertyName("urlString")] + public string? UrlString { get; set; } /// /// When to consider operation succeeded, defaults to load. Events can be either: diff --git a/src/Playwright/API/Generated/Options/PageWaitForNavigationOptions.cs b/src/Playwright/API/Generated/Options/PageWaitForNavigationOptions.cs index 89954e55..7d602a80 100644 --- a/src/Playwright/API/Generated/Options/PageWaitForNavigationOptions.cs +++ b/src/Playwright/API/Generated/Options/PageWaitForNavigationOptions.cs @@ -42,9 +42,10 @@ public class PageWaitForNavigationOptions } Timeout = clone.Timeout; - UrlString = clone.UrlString; - UrlRegex = clone.UrlRegex; + Url = clone.Url; UrlFunc = clone.UrlFunc; + UrlRegex = clone.UrlRegex; + UrlString = clone.UrlString; WaitUntil = clone.WaitUntil; } @@ -67,8 +68,19 @@ public class PageWaitForNavigationOptions /// equal to the string. /// /// - [JsonPropertyName("urlString")] - public string? UrlString { get; set; } + [JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// + /// A glob pattern, regex pattern or predicate receiving to match + /// while waiting for the navigation. Note that if the parameter is a string without + /// wildcard characters, the method will wait for navigation to URL that is exactly + /// equal to the string. + /// + /// + [JsonPropertyName("urlFunc")] + public Func? UrlFunc { get; set; } /// /// @@ -89,8 +101,8 @@ public class PageWaitForNavigationOptions /// equal to the string. /// /// - [JsonPropertyName("urlFunc")] - public Func? UrlFunc { get; set; } + [JsonPropertyName("urlString")] + public string? UrlString { get; set; } /// /// When to consider operation succeeded, defaults to load. Events can be either: diff --git a/src/Playwright/Core/APIRequestContext.cs b/src/Playwright/Core/APIRequestContext.cs index 560111e6..20fd49fd 100644 --- a/src/Playwright/Core/APIRequestContext.cs +++ b/src/Playwright/Core/APIRequestContext.cs @@ -65,7 +65,7 @@ internal class APIRequestContext : ChannelOwnerBase, IChannelOwner x != null) > 1) + if (new[] { options.Data, options.DataByte, options.DataObject, options.DataString, options.Form, options.Multipart }.Count(x => x != null) > 1) { throw new PlaywrightException("Only one of 'data', 'form' or 'multipart' can be specified"); } @@ -92,15 +92,16 @@ internal class APIRequestContext : ChannelOwnerBase, IChannelOwner x.Key, x => x.Value))) { - jsonData = options.DataString; + jsonData = dataString; } else { - postData = System.Text.Encoding.UTF8.GetBytes(options.DataString); + postData = System.Text.Encoding.UTF8.GetBytes(dataString); } } else if (options.DataByte != null) diff --git a/src/Playwright/Core/Browser.cs b/src/Playwright/Core/Browser.cs index 19aa8600..d9cd0412 100644 --- a/src/Playwright/Core/Browser.cs +++ b/src/Playwright/Core/Browser.cs @@ -116,6 +116,7 @@ internal class Browser : ChannelOwnerBase, IChannelOwner, IBrowser recordHarMode: options.RecordHarMode, recordHarOmitContent: options.RecordHarOmitContent, recordHarPath: options.RecordHarPath, + recordHarUrlFilter: options.RecordHarUrlFilter, recordHarUrlFilterString: options.RecordHarUrlFilterString, recordHarUrlFilterRegex: options.RecordHarUrlFilterRegex, recordVideo: GetVideoArgs(options.RecordVideoDir, options.RecordVideoSize), @@ -167,6 +168,7 @@ internal class Browser : ChannelOwnerBase, IChannelOwner, IBrowser RecordHarContent = options.RecordHarContent, RecordHarMode = options.RecordHarMode, RecordHarOmitContent = options.RecordHarOmitContent, + RecordHarUrlFilter = options.RecordHarUrlFilter, RecordHarUrlFilterString = options.RecordHarUrlFilterString, RecordHarUrlFilterRegex = options.RecordHarUrlFilterRegex, RecordVideoDir = options.RecordVideoDir, diff --git a/src/Playwright/Core/BrowserContext.cs b/src/Playwright/Core/BrowserContext.cs index 580f01d6..08fba0bd 100644 --- a/src/Playwright/Core/BrowserContext.cs +++ b/src/Playwright/Core/BrowserContext.cs @@ -542,6 +542,7 @@ internal class BrowserContext : ChannelOwnerBase, IChannelOwner, var harId = await Channel.HarStartAsync( page, har, + options?.Url, options?.UrlString, options?.UrlRegex).ConfigureAwait(false); _harRecorders.Add(harId, new() { Path = har, Content = HarContentPolicy.Attach }); @@ -556,6 +557,7 @@ internal class BrowserContext : ChannelOwnerBase, IChannelOwner, } var harRouter = await HarRouter.CreateAsync(Channel.Connection.LocalUtils, har, options?.NotFound ?? HarNotFound.Abort, new() { + Url = options?.Url, UrlRegex = options?.UrlRegex, UrlString = options?.UrlString, }).ConfigureAwait(false); diff --git a/src/Playwright/Core/BrowserType.cs b/src/Playwright/Core/BrowserType.cs index 7184e5f7..fad0878f 100644 --- a/src/Playwright/Core/BrowserType.cs +++ b/src/Playwright/Core/BrowserType.cs @@ -124,6 +124,7 @@ internal class BrowserType : ChannelOwnerBase, IChannelOwner, IBrow recordHarMode: options.RecordHarMode, recordHarPath: options.RecordHarPath, recordHarOmitContent: options.RecordHarOmitContent, + recordHarUrlFilter: options.RecordHarUrlFilter, recordHarUrlFilterString: options.RecordHarUrlFilterString, recordHarUrlFilterRegex: options.RecordHarUrlFilterRegex, recordVideo: Browser.GetVideoArgs(options.RecordVideoDir, options.RecordVideoSize), @@ -142,6 +143,7 @@ internal class BrowserType : ChannelOwnerBase, IChannelOwner, IBrow RecordHarMode = options.RecordHarMode, RecordHarOmitContent = options.RecordHarOmitContent, RecordHarPath = options.RecordHarPath, + RecordHarUrlFilter = options.RecordHarUrlFilter, RecordHarUrlFilterString = options.RecordHarUrlFilterString, RecordHarUrlFilterRegex = options.RecordHarUrlFilterRegex, }; diff --git a/src/Playwright/Core/Frame.cs b/src/Playwright/Core/Frame.cs index 981651f4..4487f812 100644 --- a/src/Playwright/Core/Frame.cs +++ b/src/Playwright/Core/Frame.cs @@ -199,7 +199,8 @@ internal class Frame : ChannelOwnerBase, IChannelOwner, IFrame { WaitUntilState waitUntil2 = options?.WaitUntil ?? WaitUntilState.Load; using var waiter = SetupNavigationWaiter("frame.WaitForNavigationAsync", options?.Timeout); - string toUrl = !string.IsNullOrEmpty(options?.UrlString) ? $" to \"{options?.UrlString}\"" : string.Empty; + string urlString = !string.IsNullOrEmpty(options?.Url) ? options?.Url : options?.UrlString; + string toUrl = !string.IsNullOrEmpty(urlString) ? $" to \"{urlString}\"" : string.Empty; waiter.Log($"waiting for navigation{toUrl} until \"{waitUntil2}\""); @@ -215,7 +216,8 @@ internal class Frame : ChannelOwnerBase, IChannelOwner, IFrame } waiter.Log($" navigated to \"{e.Url}\""); - return UrlMatches(e.Url, options?.UrlString, options?.UrlRegex, options?.UrlFunc); + string urlString = !string.IsNullOrEmpty(options?.Url) ? options?.Url : options?.UrlString; + return UrlMatches(e.Url, urlString, options?.UrlRegex, options?.UrlFunc); }); var navigatedEvent = await navigatedEventTask.ConfigureAwait(false); @@ -250,6 +252,7 @@ internal class Frame : ChannelOwnerBase, IChannelOwner, IFrame { var result = WaitForNavigationAsync(new() { + Url = options?.Url, UrlString = options?.UrlString, UrlRegex = options?.UrlRegex, UrlFunc = options?.UrlFunc, @@ -529,6 +532,7 @@ internal class Frame : ChannelOwnerBase, IChannelOwner, IFrame new Locator(this, selector, new() { Has = options?.Has, + HasText = options?.HasText, HasTextString = options?.HasTextString, HasTextRegex = options?.HasTextRegex, }); diff --git a/src/Playwright/Core/FrameLocator.cs b/src/Playwright/Core/FrameLocator.cs index 4f033282..de5aff02 100644 --- a/src/Playwright/Core/FrameLocator.cs +++ b/src/Playwright/Core/FrameLocator.cs @@ -81,7 +81,7 @@ internal class FrameLocator : IFrameLocator IFrameLocator IFrameLocator.FrameLocator(string selector) => new FrameLocator(_frame, $"{_frameSelector} >> internal:control=enter-frame >> {selector}"); - public ILocator Locator(string selector, FrameLocatorLocatorOptions options = null) => new Locator(_frame, $"{_frameSelector} >> internal:control=enter-frame >> {selector}", new() { HasTextRegex = options?.HasTextRegex, HasTextString = options?.HasTextString }); + public ILocator Locator(string selector, FrameLocatorLocatorOptions options = null) => new Locator(_frame, $"{_frameSelector} >> internal:control=enter-frame >> {selector}", new() { HasText = options?.HasText, HasTextRegex = options?.HasTextRegex, HasTextString = options?.HasTextString }); public IFrameLocator Nth(int index) => new FrameLocator(_frame, $"{_frameSelector} >> nth={index}"); } diff --git a/src/Playwright/Core/HarRouter.cs b/src/Playwright/Core/HarRouter.cs index d620cec0..04e6a771 100644 --- a/src/Playwright/Core/HarRouter.cs +++ b/src/Playwright/Core/HarRouter.cs @@ -99,7 +99,11 @@ internal class HarRouter internal async Task AddContextRouteAsync(BrowserContext context) { - if (!string.IsNullOrEmpty(_options.UrlString)) + if (!string.IsNullOrEmpty(_options.Url)) + { + await context.RouteAsync(_options.Url, route => HandleAsync((Route)route)).ConfigureAwait(false); + } + else if (!string.IsNullOrEmpty(_options.UrlString)) { await context.RouteAsync(_options.UrlString, route => HandleAsync((Route)route)).ConfigureAwait(false); } @@ -117,7 +121,11 @@ internal class HarRouter internal async Task AddPageRouteAsync(Page page) { - if (!string.IsNullOrEmpty(_options.UrlString)) + if (!string.IsNullOrEmpty(_options.Url)) + { + await page.RouteAsync(_options.Url, route => HandleAsync((Route)route)).ConfigureAwait(false); + } + else if (!string.IsNullOrEmpty(_options.UrlString)) { await page.RouteAsync(_options.UrlString, route => HandleAsync((Route)route)).ConfigureAwait(false); } @@ -138,6 +146,8 @@ internal class HarRouter internal class HarRouterOptions { + internal string Url { get; set; } + internal string UrlString { get; set; } internal Regex UrlRegex { get; set; } diff --git a/src/Playwright/Core/Locator.cs b/src/Playwright/Core/Locator.cs index 6fa025ca..ec27e1ba 100644 --- a/src/Playwright/Core/Locator.cs +++ b/src/Playwright/Core/Locator.cs @@ -56,6 +56,10 @@ internal class Locator : ILocator { _selector += $" >> internal:has-text={EscapeForTextSelector(options.HasTextRegex, false)}"; } + else if (options?.HasText != null) + { + _selector += $" >> internal:has-text={EscapeForTextSelector(options.HasText, false)}"; + } else if (options?.HasTextString != null) { _selector += $" >> internal:has-text={EscapeForTextSelector(options.HasTextString, false)}"; @@ -149,6 +153,7 @@ internal class Locator : ILocator new Locator(_frame, _selector, new() { Has = options?.Has, + HasText = options?.HasText, HasTextString = options?.HasTextString, HasTextRegex = options?.HasTextRegex, }); @@ -452,7 +457,11 @@ internal class Locator : ILocator { props.Add(new List { "level", options.Level.ToString() }); } - if (options.NameString != null) + if (options.Name != null) + { + props.Add(new List { "name", EscapeForAttributeSelector(options.Name, false) }); + } + else if (options.NameString != null) { props.Add(new List { "name", EscapeForAttributeSelector(options.NameString, false) }); } @@ -515,6 +524,7 @@ internal class ByRoleOptions Expanded = clone.Expanded; IncludeHidden = clone.IncludeHidden; Level = clone.Level; + Name = clone.Name; NameString = clone.NameString; NameRegex = clone.NameRegex; Pressed = clone.Pressed; @@ -532,6 +542,7 @@ internal class ByRoleOptions Expanded = clone.Expanded; IncludeHidden = clone.IncludeHidden; Level = clone.Level; + Name = clone.Name; NameString = clone.NameString; NameRegex = clone.NameRegex; Pressed = clone.Pressed; @@ -549,6 +560,7 @@ internal class ByRoleOptions Expanded = clone.Expanded; IncludeHidden = clone.IncludeHidden; Level = clone.Level; + Name = clone.Name; NameString = clone.NameString; NameRegex = clone.NameRegex; Pressed = clone.Pressed; @@ -566,6 +578,7 @@ internal class ByRoleOptions Expanded = clone.Expanded; IncludeHidden = clone.IncludeHidden; Level = clone.Level; + Name = clone.Name; NameString = clone.NameString; NameRegex = clone.NameRegex; Pressed = clone.Pressed; @@ -582,6 +595,8 @@ internal class ByRoleOptions public int? Level { get; set; } + public string Name { get; set; } + public string NameString { get; set; } public Regex NameRegex { get; set; } diff --git a/src/Playwright/Core/Page.cs b/src/Playwright/Core/Page.cs index a87f5c68..0340a067 100644 --- a/src/Playwright/Core/Page.cs +++ b/src/Playwright/Core/Page.cs @@ -326,6 +326,7 @@ internal class Page : ChannelOwnerBase, IChannelOwner, IPage public Task WaitForNavigationAsync(PageWaitForNavigationOptions options = default) => MainFrame.WaitForNavigationAsync(new() { + Url = options?.Url, UrlString = options?.UrlString, UrlRegex = options?.UrlRegex, UrlFunc = options?.UrlFunc, @@ -336,6 +337,7 @@ internal class Page : ChannelOwnerBase, IChannelOwner, IPage public Task RunAndWaitForNavigationAsync(Func action, PageRunAndWaitForNavigationOptions options = default) => MainFrame.RunAndWaitForNavigationAsync(action, new() { + Url = options?.Url, UrlString = options?.UrlString, UrlRegex = options?.UrlRegex, UrlFunc = options?.UrlFunc, @@ -466,6 +468,7 @@ internal class Page : ChannelOwnerBase, IChannelOwner, IPage => MainFrame.Locator(selector, new() { Has = options?.Has, + HasText = options?.HasText, HasTextString = options?.HasTextString, HasTextRegex = options?.HasTextRegex, }); @@ -1151,6 +1154,7 @@ internal class Page : ChannelOwnerBase, IChannelOwner, IPage await Context.RecordIntoHarAsync(har, this, new() { NotFound = options?.NotFound, + Url = options?.Url, UrlString = options?.UrlString, UrlRegex = options?.UrlRegex, }).ConfigureAwait(false); @@ -1159,6 +1163,7 @@ internal class Page : ChannelOwnerBase, IChannelOwner, IPage var harRouter = await HarRouter.CreateAsync(Channel.Connection.LocalUtils, har, options?.NotFound ?? HarNotFound.Abort, new() { UrlRegex = options?.UrlRegex, + Url = options?.Url, UrlString = options?.UrlString, }).ConfigureAwait(false); await harRouter.AddPageRouteAsync(this).ConfigureAwait(false); diff --git a/src/Playwright/Transport/Channels/BrowserChannel.cs b/src/Playwright/Transport/Channels/BrowserChannel.cs index acbf172e..3e2f94b8 100644 --- a/src/Playwright/Transport/Channels/BrowserChannel.cs +++ b/src/Playwright/Transport/Channels/BrowserChannel.cs @@ -48,6 +48,7 @@ internal class BrowserChannel : Channel HarMode? recordHarMode, string recordHarPath, bool? recordHarOmitContent, + string recordHarUrlFilter, string recordHarUrlFilterString, Regex recordHarUrlFilterRegex) { @@ -65,7 +66,11 @@ internal class BrowserChannel : Channel { recordHarArgs["content"] = HarContentPolicy.Omit; } - if (!string.IsNullOrEmpty(recordHarUrlFilterString)) + if (!string.IsNullOrEmpty(recordHarUrlFilter)) + { + recordHarArgs["urlGlob"] = recordHarUrlFilter; + } + else if (!string.IsNullOrEmpty(recordHarUrlFilterString)) { recordHarArgs["urlGlob"] = recordHarUrlFilterString; } @@ -118,6 +123,7 @@ internal class BrowserChannel : Channel HarMode? recordHarMode = default, string recordHarPath = default, bool? recordHarOmitContent = default, + string recordHarUrlFilter = default, string recordHarUrlFilterString = default, Regex recordHarUrlFilterRegex = default, Dictionary recordVideo = null, @@ -165,6 +171,7 @@ internal class BrowserChannel : Channel recordHarMode: recordHarMode, recordHarPath: recordHarPath, recordHarOmitContent: recordHarOmitContent, + recordHarUrlFilter: recordHarUrlFilter, recordHarUrlFilterString: recordHarUrlFilterString, recordHarUrlFilterRegex: recordHarUrlFilterRegex); if (recordHarOptions != null) diff --git a/src/Playwright/Transport/Channels/BrowserContextChannel.cs b/src/Playwright/Transport/Channels/BrowserContextChannel.cs index eacb166d..3a963c64 100644 --- a/src/Playwright/Transport/Channels/BrowserContextChannel.cs +++ b/src/Playwright/Transport/Channels/BrowserContextChannel.cs @@ -247,13 +247,14 @@ internal class BrowserContextChannel : Channel internal async Task HarStartAsync( Page page, string path, + string recordHarUrlFilter, string recordHarUrlFilterString, Regex recordHarUrlFilterRegex) { var args = new Dictionary { { "page", page?.Channel }, - { "options", BrowserChannel.PrepareHarOptions(HarContentPolicy.Attach, HarMode.Minimal, path, null, recordHarUrlFilterString, recordHarUrlFilterRegex) }, + { "options", BrowserChannel.PrepareHarOptions(HarContentPolicy.Attach, HarMode.Minimal, path, null, recordHarUrlFilter, recordHarUrlFilterString, recordHarUrlFilterRegex) }, }; var result = await Connection.SendMessageToServerAsync( Guid, diff --git a/src/Playwright/Transport/Channels/BrowserTypeChannel.cs b/src/Playwright/Transport/Channels/BrowserTypeChannel.cs index ee6f026a..0b590515 100644 --- a/src/Playwright/Transport/Channels/BrowserTypeChannel.cs +++ b/src/Playwright/Transport/Channels/BrowserTypeChannel.cs @@ -125,6 +125,7 @@ internal class BrowserTypeChannel : Channel HarMode? recordHarMode = default, string recordHarPath = default, bool? recordHarOmitContent = default, + string recordHarUrlFilter = default, string recordHarUrlFilterString = default, Regex recordHarUrlFilterRegex = default, Dictionary recordVideo = default, @@ -164,6 +165,7 @@ internal class BrowserTypeChannel : Channel recordHarMode: recordHarMode, recordHarPath: recordHarPath, recordHarOmitContent: recordHarOmitContent, + recordHarUrlFilter: recordHarUrlFilter, recordHarUrlFilterString: recordHarUrlFilterString, recordHarUrlFilterRegex: recordHarUrlFilterRegex); if (recordHarOptions != null)