feat: roll to new option overloads (#2387)

This makes string option overloads to support unsuffixed name, e.g.
`Name` in addition to `NameString` and `NameRegex`.
This commit is contained in:
Dmitry Gozman 2022-11-15 15:47:28 -08:00 коммит произвёл GitHub
Родитель 304bb6984a
Коммит bca5358a0f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
36 изменённых файлов: 443 добавлений и 143 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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 =>
{

Просмотреть файл

@ -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<string, string>() { ["Content-Type"] = "application/json" } });
var response = await request.PostAsync(Server.EmptyPage, new() { Data = "My post data", Headers = new Dictionary<string, string>() { ["Content-Type"] = "application/json" } });
var str = response.ToString();
StringAssert.Contains("APIResponse: 200 OK", str);
foreach (var header in response.HeadersArray)

Просмотреть файл

@ -92,7 +92,7 @@ public class LocatorQueryTests : PageTestEx
public async Task ShouldFilterByText2()
{
await Page.SetContentAsync("<div>foo <span>hello world</span> bar</div>");
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("<section><div><span>hello</span></div><div><span>world</span></div></section>");
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'")]

Просмотреть файл

@ -251,12 +251,12 @@ public class SelectorsRoleTests : PageTestEx
Assert.AreEqual(await Page.GetByRole(AriaRole.Button, new() { NameRegex = new Regex("h.*o", RegexOptions.IgnoreCase) }).EvaluateAllAsync<string[]>("els => els.map(e => e.outerHTML)"), new string[] { "<div role=\"button\" aria-label=\"Hello\"></div>", "<div role=\"button\" aria-label=\"Hallo\"></div>" });
Assert.AreEqual(await Page.Locator("role=button[name=Hello][include-hidden]").EvaluateAllAsync<string[]>("els => els.map(e => e.outerHTML)"), new string[] { "<div role=\"button\" aria-label=\"Hello\"></div>", "<div role=\"button\" aria-label=\"Hello\" aria-hidden=\"true\"></div>" });
Assert.AreEqual(await Page.GetByRole(AriaRole.Button, new() { NameString = "Hello", IncludeHidden = true }).EvaluateAllAsync<string[]>("els => els.map(e => e.outerHTML)"), new string[] { "<div role=\"button\" aria-label=\"Hello\"></div>", "<div role=\"button\" aria-label=\"Hello\" aria-hidden=\"true\"></div>" });
Assert.AreEqual(await Page.GetByRole(AriaRole.Button, new() { Name = "Hello", IncludeHidden = true }).EvaluateAllAsync<string[]>("els => els.map(e => e.outerHTML)"), new string[] { "<div role=\"button\" aria-label=\"Hello\"></div>", "<div role=\"button\" aria-label=\"Hello\" aria-hidden=\"true\"></div>" });
Assert.AreEqual(await Page.GetByRole(AriaRole.Button, new() { NameString = "hello", IncludeHidden = true }).EvaluateAllAsync<string[]>("els => els.map(e => e.outerHTML)"), new string[] { "<div role=\"button\" aria-label=\"Hello\"></div>", "<div role=\"button\" aria-label=\"Hello\" aria-hidden=\"true\"></div>" });
Assert.AreEqual(await Page.Locator("role=button[name=Hello]").EvaluateAllAsync<string[]>("els => els.map(e => e.outerHTML)"), new string[] { "<div role=\"button\" aria-label=\"Hello\"></div>" });
Assert.AreEqual(await Page.Locator("role=button[name=123][include-hidden]").EvaluateAllAsync<string[]>("els => els.map(e => e.outerHTML)"), new string[] { "<div role=\"button\" aria-label=\"123\" aria-hidden=\"true\"></div>" });
Assert.AreEqual(await Page.GetByRole(AriaRole.Button, new() { NameString = "123", IncludeHidden = true }).EvaluateAllAsync<string[]>("els => els.map(e => e.outerHTML)"), new string[] { "<div role=\"button\" aria-label=\"123\" aria-hidden=\"true\"></div>" });
Assert.AreEqual(await Page.GetByRole(AriaRole.Button, new() { Name = "123", IncludeHidden = true }).EvaluateAllAsync<string[]>("els => els.map(e => e.outerHTML)"), new string[] { "<div role=\"button\" aria-label=\"123\" aria-hidden=\"true\"></div>" });
}

Просмотреть файл

@ -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.
/// </para>
/// </summary>
[JsonPropertyName("dataString")]
public string? DataString { get; set; }
[JsonPropertyName("data")]
public string? Data { get; set; }
/// <summary>
/// <para>
@ -87,6 +88,17 @@ public class APIRequestContextOptions
[JsonPropertyName("dataObject")]
public object? DataObject { get; set; }
/// <summary>
/// <para>
/// Allows to set post data of the request. If the data parameter is an object, it will
/// be serialized to json string and <c>content-type</c> header will be set to <c>application/json</c>
/// if not explicitly set. Otherwise the <c>content-type</c> header will be set to <c>application/octet-stream</c>
/// if not explicitly set.
/// </para>
/// </summary>
[JsonPropertyName("dataString")]
public string? DataString { get; set; }
/// <summary>
/// <para>
/// Whether to throw on response codes other than 2xx and 3xx. By default response object

Просмотреть файл

@ -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;
}
/// <summary>
@ -73,8 +74,8 @@ public class BrowserContextRouteFromHAROptions
/// all requests are served from the HAR file.
/// </para>
/// </summary>
[JsonPropertyName("urlString")]
public string? UrlString { get; set; }
[JsonPropertyName("url")]
public string? Url { get; set; }
/// <summary>
/// <para>
@ -85,6 +86,16 @@ public class BrowserContextRouteFromHAROptions
/// </summary>
[JsonPropertyName("urlRegex")]
public Regex? UrlRegex { get; set; }
/// <summary>
/// <para>
/// 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.
/// </para>
/// </summary>
[JsonPropertyName("urlString")]
public string? UrlString { get; set; }
}
#nullable disable

Просмотреть файл

@ -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; }
/// <summary>
/// <para>
/// Enables video recording for all pages into the specified directory. If not specified

Просмотреть файл

@ -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; }
/// <summary>
/// <para>
/// Enables video recording for all pages into the specified directory. If not specified

Просмотреть файл

@ -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; }
/// <summary>
/// <para>
/// Enables video recording for all pages into the specified directory. If not specified

Просмотреть файл

@ -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
/// <summary>
/// <para>
/// An attribute that is usually set by <c>aria-checked</c> or native <c>&lt;input type=checkbox&gt;</c>
/// controls. Available values for checked are <c>true</c>, <c>false</c> and <c>"mixed"</c>.
/// controls.
/// </para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-checked"><c>aria-checked</c></a>.</para>
/// </summary>
[JsonPropertyName("checked")]
public bool? Checked { get; set; }
/// <summary><para>A boolean attribute that is usually set by <c>aria-disabled</c> or <c>disabled</c>.</para></summary>
/// <summary><para>An attribute that is usually set by <c>aria-disabled</c> or <c>disabled</c>.</para></summary>
/// <remarks>
/// <para>
/// Unlike most other attributes, <c>disabled</c> is inherited through the DOM hierarchy.
@ -72,7 +74,17 @@ public class FrameGetByRoleOptions
public bool? Disabled { get; set; }
/// <summary>
/// <para>A boolean attribute that is usually set by <c>aria-expanded</c>.</para>
/// <para>
/// Whether <paramref name="name"/> is matched exactly: case-sensitive and whole-string.
/// Defaults to false. Ignored when <paramref name="name"/> is a regular expression.
/// Note that exact match still trims whitespace.
/// </para>
/// </summary>
[JsonPropertyName("exact")]
public bool? Exact { get; set; }
/// <summary>
/// <para>An attribute that is usually set by <c>aria-expanded</c>.</para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-expanded"><c>aria-expanded</c></a>.</para>
/// </summary>
[JsonPropertyName("expanded")]
@ -80,8 +92,8 @@ public class FrameGetByRoleOptions
/// <summary>
/// <para>
/// A boolean attribute that controls whether hidden elements are matched. By default,
/// only non-hidden elements, as <a href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined
/// Option that controls whether hidden elements are matched. By default, only non-hidden
/// elements, as <a href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined
/// by ARIA</a>, are matched by role selector.
/// </para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-hidden"><c>aria-hidden</c></a>.</para>
@ -102,21 +114,23 @@ public class FrameGetByRoleOptions
/// <summary>
/// <para>
/// A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>. By default, matching is case-insensitive and searches for a substring,
/// use <paramref name="exact"/> to control this behavior.
/// </para>
/// <para>
/// Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// </para>
/// </summary>
[JsonPropertyName("nameString")]
public string? NameString { get; set; }
[JsonPropertyName("name")]
public string? Name { get; set; }
/// <summary>
/// <para>
/// A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>. By default, matching is case-insensitive and searches for a substring,
/// use <paramref name="exact"/> to control this behavior.
/// </para>
/// <para>
/// Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
@ -128,16 +142,27 @@ public class FrameGetByRoleOptions
/// <summary>
/// <para>
/// An attribute that is usually set by <c>aria-pressed</c>. Available values for pressed
/// are <c>true</c>, <c>false</c> and <c>"mixed"</c>.
/// Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>. By default, matching is case-insensitive and searches for a substring,
/// use <paramref name="exact"/> to control this behavior.
/// </para>
/// <para>
/// Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// </para>
/// </summary>
[JsonPropertyName("nameString")]
public string? NameString { get; set; }
/// <summary>
/// <para>An attribute that is usually set by <c>aria-pressed</c>.</para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-pressed"><c>aria-pressed</c></a>.</para>
/// </summary>
[JsonPropertyName("pressed")]
public bool? Pressed { get; set; }
/// <summary>
/// <para>A boolean attribute that is usually set by <c>aria-selected</c>.</para>
/// <para>An attribute that is usually set by <c>aria-selected</c>.</para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-selected"><c>aria-selected</c></a>.</para>
/// </summary>
[JsonPropertyName("selected")]

Просмотреть файл

@ -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
/// <summary>
/// <para>
/// An attribute that is usually set by <c>aria-checked</c> or native <c>&lt;input type=checkbox&gt;</c>
/// controls. Available values for checked are <c>true</c>, <c>false</c> and <c>"mixed"</c>.
/// controls.
/// </para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-checked"><c>aria-checked</c></a>.</para>
/// </summary>
[JsonPropertyName("checked")]
public bool? Checked { get; set; }
/// <summary><para>A boolean attribute that is usually set by <c>aria-disabled</c> or <c>disabled</c>.</para></summary>
/// <summary><para>An attribute that is usually set by <c>aria-disabled</c> or <c>disabled</c>.</para></summary>
/// <remarks>
/// <para>
/// Unlike most other attributes, <c>disabled</c> is inherited through the DOM hierarchy.
@ -72,7 +74,17 @@ public class FrameLocatorGetByRoleOptions
public bool? Disabled { get; set; }
/// <summary>
/// <para>A boolean attribute that is usually set by <c>aria-expanded</c>.</para>
/// <para>
/// Whether <paramref name="name"/> is matched exactly: case-sensitive and whole-string.
/// Defaults to false. Ignored when <paramref name="name"/> is a regular expression.
/// Note that exact match still trims whitespace.
/// </para>
/// </summary>
[JsonPropertyName("exact")]
public bool? Exact { get; set; }
/// <summary>
/// <para>An attribute that is usually set by <c>aria-expanded</c>.</para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-expanded"><c>aria-expanded</c></a>.</para>
/// </summary>
[JsonPropertyName("expanded")]
@ -80,8 +92,8 @@ public class FrameLocatorGetByRoleOptions
/// <summary>
/// <para>
/// A boolean attribute that controls whether hidden elements are matched. By default,
/// only non-hidden elements, as <a href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined
/// Option that controls whether hidden elements are matched. By default, only non-hidden
/// elements, as <a href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined
/// by ARIA</a>, are matched by role selector.
/// </para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-hidden"><c>aria-hidden</c></a>.</para>
@ -102,21 +114,23 @@ public class FrameLocatorGetByRoleOptions
/// <summary>
/// <para>
/// A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>. By default, matching is case-insensitive and searches for a substring,
/// use <paramref name="exact"/> to control this behavior.
/// </para>
/// <para>
/// Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// </para>
/// </summary>
[JsonPropertyName("nameString")]
public string? NameString { get; set; }
[JsonPropertyName("name")]
public string? Name { get; set; }
/// <summary>
/// <para>
/// A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>. By default, matching is case-insensitive and searches for a substring,
/// use <paramref name="exact"/> to control this behavior.
/// </para>
/// <para>
/// Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
@ -128,16 +142,27 @@ public class FrameLocatorGetByRoleOptions
/// <summary>
/// <para>
/// An attribute that is usually set by <c>aria-pressed</c>. Available values for pressed
/// are <c>true</c>, <c>false</c> and <c>"mixed"</c>.
/// Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>. By default, matching is case-insensitive and searches for a substring,
/// use <paramref name="exact"/> to control this behavior.
/// </para>
/// <para>
/// Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// </para>
/// </summary>
[JsonPropertyName("nameString")]
public string? NameString { get; set; }
/// <summary>
/// <para>An attribute that is usually set by <c>aria-pressed</c>.</para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-pressed"><c>aria-pressed</c></a>.</para>
/// </summary>
[JsonPropertyName("pressed")]
public bool? Pressed { get; set; }
/// <summary>
/// <para>A boolean attribute that is usually set by <c>aria-selected</c>.</para>
/// <para>An attribute that is usually set by <c>aria-selected</c>.</para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-selected"><c>aria-selected</c></a>.</para>
/// </summary>
[JsonPropertyName("selected")]

Просмотреть файл

@ -41,8 +41,9 @@ public class FrameLocatorLocatorOptions
}
Has = clone.Has;
HasTextString = clone.HasTextString;
HasText = clone.HasText;
HasTextRegex = clone.HasTextRegex;
HasTextString = clone.HasTextString;
}
/// <summary>
@ -66,8 +67,8 @@ public class FrameLocatorLocatorOptions
/// and searches for a substring. For example, <c>"Playwright"</c> matches <c>&lt;article&gt;&lt;div&gt;Playwright&lt;/div&gt;&lt;/article&gt;</c>.
/// </para>
/// </summary>
[JsonPropertyName("hasTextString")]
public string? HasTextString { get; set; }
[JsonPropertyName("hasText")]
public string? HasText { get; set; }
/// <summary>
/// <para>
@ -78,6 +79,16 @@ public class FrameLocatorLocatorOptions
/// </summary>
[JsonPropertyName("hasTextRegex")]
public Regex? HasTextRegex { get; set; }
/// <summary>
/// <para>
/// Matches elements containing specified text somewhere inside, possibly in a child
/// or a descendant element. When passed a <see cref="string"/>, matching is case-insensitive
/// and searches for a substring. For example, <c>"Playwright"</c> matches <c>&lt;article&gt;&lt;div&gt;Playwright&lt;/div&gt;&lt;/article&gt;</c>.
/// </para>
/// </summary>
[JsonPropertyName("hasTextString")]
public string? HasTextString { get; set; }
}
#nullable disable

Просмотреть файл

@ -41,8 +41,9 @@ public class FrameLocatorOptions
}
Has = clone.Has;
HasTextString = clone.HasTextString;
HasText = clone.HasText;
HasTextRegex = clone.HasTextRegex;
HasTextString = clone.HasTextString;
}
/// <summary>
@ -66,8 +67,8 @@ public class FrameLocatorOptions
/// and searches for a substring. For example, <c>"Playwright"</c> matches <c>&lt;article&gt;&lt;div&gt;Playwright&lt;/div&gt;&lt;/article&gt;</c>.
/// </para>
/// </summary>
[JsonPropertyName("hasTextString")]
public string? HasTextString { get; set; }
[JsonPropertyName("hasText")]
public string? HasText { get; set; }
/// <summary>
/// <para>
@ -78,6 +79,16 @@ public class FrameLocatorOptions
/// </summary>
[JsonPropertyName("hasTextRegex")]
public Regex? HasTextRegex { get; set; }
/// <summary>
/// <para>
/// Matches elements containing specified text somewhere inside, possibly in a child
/// or a descendant element. When passed a <see cref="string"/>, matching is case-insensitive
/// and searches for a substring. For example, <c>"Playwright"</c> matches <c>&lt;article&gt;&lt;div&gt;Playwright&lt;/div&gt;&lt;/article&gt;</c>.
/// </para>
/// </summary>
[JsonPropertyName("hasTextString")]
public string? HasTextString { get; set; }
}
#nullable disable

Просмотреть файл

@ -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.
/// </para>
/// </summary>
[JsonPropertyName("urlString")]
public string? UrlString { get; set; }
[JsonPropertyName("url")]
public string? Url { get; set; }
/// <summary>
/// <para>
/// A glob pattern, regex pattern or predicate receiving <see cref="URL"/> 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.
/// </para>
/// </summary>
[JsonPropertyName("urlFunc")]
public Func<string, bool>? UrlFunc { get; set; }
/// <summary>
/// <para>
@ -89,8 +101,8 @@ public class FrameRunAndWaitForNavigationOptions
/// equal to the string.
/// </para>
/// </summary>
[JsonPropertyName("urlFunc")]
public Func<string, bool>? UrlFunc { get; set; }
[JsonPropertyName("urlString")]
public string? UrlString { get; set; }
/// <summary>
/// <para>When to consider operation succeeded, defaults to <c>load</c>. Events can be either:</para>

Просмотреть файл

@ -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.
/// </para>
/// </summary>
[JsonPropertyName("urlString")]
public string? UrlString { get; set; }
[JsonPropertyName("url")]
public string? Url { get; set; }
/// <summary>
/// <para>
/// A glob pattern, regex pattern or predicate receiving <see cref="URL"/> 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.
/// </para>
/// </summary>
[JsonPropertyName("urlFunc")]
public Func<string, bool>? UrlFunc { get; set; }
/// <summary>
/// <para>
@ -89,8 +101,8 @@ public class FrameWaitForNavigationOptions
/// equal to the string.
/// </para>
/// </summary>
[JsonPropertyName("urlFunc")]
public Func<string, bool>? UrlFunc { get; set; }
[JsonPropertyName("urlString")]
public string? UrlString { get; set; }
/// <summary>
/// <para>When to consider operation succeeded, defaults to <c>load</c>. Events can be either:</para>

Просмотреть файл

@ -41,8 +41,9 @@ public class LocatorFilterOptions
}
Has = clone.Has;
HasTextString = clone.HasTextString;
HasText = clone.HasText;
HasTextRegex = clone.HasTextRegex;
HasTextString = clone.HasTextString;
}
/// <summary>
@ -66,8 +67,8 @@ public class LocatorFilterOptions
/// and searches for a substring. For example, <c>"Playwright"</c> matches <c>&lt;article&gt;&lt;div&gt;Playwright&lt;/div&gt;&lt;/article&gt;</c>.
/// </para>
/// </summary>
[JsonPropertyName("hasTextString")]
public string? HasTextString { get; set; }
[JsonPropertyName("hasText")]
public string? HasText { get; set; }
/// <summary>
/// <para>
@ -78,6 +79,16 @@ public class LocatorFilterOptions
/// </summary>
[JsonPropertyName("hasTextRegex")]
public Regex? HasTextRegex { get; set; }
/// <summary>
/// <para>
/// Matches elements containing specified text somewhere inside, possibly in a child
/// or a descendant element. When passed a <see cref="string"/>, matching is case-insensitive
/// and searches for a substring. For example, <c>"Playwright"</c> matches <c>&lt;article&gt;&lt;div&gt;Playwright&lt;/div&gt;&lt;/article&gt;</c>.
/// </para>
/// </summary>
[JsonPropertyName("hasTextString")]
public string? HasTextString { get; set; }
}
#nullable disable

Просмотреть файл

@ -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
/// <summary>
/// <para>
/// An attribute that is usually set by <c>aria-checked</c> or native <c>&lt;input type=checkbox&gt;</c>
/// controls. Available values for checked are <c>true</c>, <c>false</c> and <c>"mixed"</c>.
/// controls.
/// </para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-checked"><c>aria-checked</c></a>.</para>
/// </summary>
[JsonPropertyName("checked")]
public bool? Checked { get; set; }
/// <summary><para>A boolean attribute that is usually set by <c>aria-disabled</c> or <c>disabled</c>.</para></summary>
/// <summary><para>An attribute that is usually set by <c>aria-disabled</c> or <c>disabled</c>.</para></summary>
/// <remarks>
/// <para>
/// Unlike most other attributes, <c>disabled</c> is inherited through the DOM hierarchy.
@ -72,7 +74,17 @@ public class LocatorGetByRoleOptions
public bool? Disabled { get; set; }
/// <summary>
/// <para>A boolean attribute that is usually set by <c>aria-expanded</c>.</para>
/// <para>
/// Whether <paramref name="name"/> is matched exactly: case-sensitive and whole-string.
/// Defaults to false. Ignored when <paramref name="name"/> is a regular expression.
/// Note that exact match still trims whitespace.
/// </para>
/// </summary>
[JsonPropertyName("exact")]
public bool? Exact { get; set; }
/// <summary>
/// <para>An attribute that is usually set by <c>aria-expanded</c>.</para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-expanded"><c>aria-expanded</c></a>.</para>
/// </summary>
[JsonPropertyName("expanded")]
@ -80,8 +92,8 @@ public class LocatorGetByRoleOptions
/// <summary>
/// <para>
/// A boolean attribute that controls whether hidden elements are matched. By default,
/// only non-hidden elements, as <a href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined
/// Option that controls whether hidden elements are matched. By default, only non-hidden
/// elements, as <a href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined
/// by ARIA</a>, are matched by role selector.
/// </para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-hidden"><c>aria-hidden</c></a>.</para>
@ -102,21 +114,23 @@ public class LocatorGetByRoleOptions
/// <summary>
/// <para>
/// A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>. By default, matching is case-insensitive and searches for a substring,
/// use <paramref name="exact"/> to control this behavior.
/// </para>
/// <para>
/// Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// </para>
/// </summary>
[JsonPropertyName("nameString")]
public string? NameString { get; set; }
[JsonPropertyName("name")]
public string? Name { get; set; }
/// <summary>
/// <para>
/// A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>. By default, matching is case-insensitive and searches for a substring,
/// use <paramref name="exact"/> to control this behavior.
/// </para>
/// <para>
/// Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
@ -128,16 +142,27 @@ public class LocatorGetByRoleOptions
/// <summary>
/// <para>
/// An attribute that is usually set by <c>aria-pressed</c>. Available values for pressed
/// are <c>true</c>, <c>false</c> and <c>"mixed"</c>.
/// Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>. By default, matching is case-insensitive and searches for a substring,
/// use <paramref name="exact"/> to control this behavior.
/// </para>
/// <para>
/// Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// </para>
/// </summary>
[JsonPropertyName("nameString")]
public string? NameString { get; set; }
/// <summary>
/// <para>An attribute that is usually set by <c>aria-pressed</c>.</para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-pressed"><c>aria-pressed</c></a>.</para>
/// </summary>
[JsonPropertyName("pressed")]
public bool? Pressed { get; set; }
/// <summary>
/// <para>A boolean attribute that is usually set by <c>aria-selected</c>.</para>
/// <para>An attribute that is usually set by <c>aria-selected</c>.</para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-selected"><c>aria-selected</c></a>.</para>
/// </summary>
[JsonPropertyName("selected")]

Просмотреть файл

@ -41,8 +41,9 @@ public class LocatorLocatorOptions
}
Has = clone.Has;
HasTextString = clone.HasTextString;
HasText = clone.HasText;
HasTextRegex = clone.HasTextRegex;
HasTextString = clone.HasTextString;
}
/// <summary>
@ -66,8 +67,8 @@ public class LocatorLocatorOptions
/// and searches for a substring. For example, <c>"Playwright"</c> matches <c>&lt;article&gt;&lt;div&gt;Playwright&lt;/div&gt;&lt;/article&gt;</c>.
/// </para>
/// </summary>
[JsonPropertyName("hasTextString")]
public string? HasTextString { get; set; }
[JsonPropertyName("hasText")]
public string? HasText { get; set; }
/// <summary>
/// <para>
@ -78,6 +79,16 @@ public class LocatorLocatorOptions
/// </summary>
[JsonPropertyName("hasTextRegex")]
public Regex? HasTextRegex { get; set; }
/// <summary>
/// <para>
/// Matches elements containing specified text somewhere inside, possibly in a child
/// or a descendant element. When passed a <see cref="string"/>, matching is case-insensitive
/// and searches for a substring. For example, <c>"Playwright"</c> matches <c>&lt;article&gt;&lt;div&gt;Playwright&lt;/div&gt;&lt;/article&gt;</c>.
/// </para>
/// </summary>
[JsonPropertyName("hasTextString")]
public string? HasTextString { get; set; }
}
#nullable disable

Просмотреть файл

@ -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
/// <summary>
/// <para>
/// An attribute that is usually set by <c>aria-checked</c> or native <c>&lt;input type=checkbox&gt;</c>
/// controls. Available values for checked are <c>true</c>, <c>false</c> and <c>"mixed"</c>.
/// controls.
/// </para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-checked"><c>aria-checked</c></a>.</para>
/// </summary>
[JsonPropertyName("checked")]
public bool? Checked { get; set; }
/// <summary><para>A boolean attribute that is usually set by <c>aria-disabled</c> or <c>disabled</c>.</para></summary>
/// <summary><para>An attribute that is usually set by <c>aria-disabled</c> or <c>disabled</c>.</para></summary>
/// <remarks>
/// <para>
/// Unlike most other attributes, <c>disabled</c> is inherited through the DOM hierarchy.
@ -72,7 +74,17 @@ public class PageGetByRoleOptions
public bool? Disabled { get; set; }
/// <summary>
/// <para>A boolean attribute that is usually set by <c>aria-expanded</c>.</para>
/// <para>
/// Whether <paramref name="name"/> is matched exactly: case-sensitive and whole-string.
/// Defaults to false. Ignored when <paramref name="name"/> is a regular expression.
/// Note that exact match still trims whitespace.
/// </para>
/// </summary>
[JsonPropertyName("exact")]
public bool? Exact { get; set; }
/// <summary>
/// <para>An attribute that is usually set by <c>aria-expanded</c>.</para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-expanded"><c>aria-expanded</c></a>.</para>
/// </summary>
[JsonPropertyName("expanded")]
@ -80,8 +92,8 @@ public class PageGetByRoleOptions
/// <summary>
/// <para>
/// A boolean attribute that controls whether hidden elements are matched. By default,
/// only non-hidden elements, as <a href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined
/// Option that controls whether hidden elements are matched. By default, only non-hidden
/// elements, as <a href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined
/// by ARIA</a>, are matched by role selector.
/// </para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-hidden"><c>aria-hidden</c></a>.</para>
@ -102,21 +114,23 @@ public class PageGetByRoleOptions
/// <summary>
/// <para>
/// A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>. By default, matching is case-insensitive and searches for a substring,
/// use <paramref name="exact"/> to control this behavior.
/// </para>
/// <para>
/// Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// </para>
/// </summary>
[JsonPropertyName("nameString")]
public string? NameString { get; set; }
[JsonPropertyName("name")]
public string? Name { get; set; }
/// <summary>
/// <para>
/// A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>. By default, matching is case-insensitive and searches for a substring,
/// use <paramref name="exact"/> to control this behavior.
/// </para>
/// <para>
/// Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
@ -128,16 +142,27 @@ public class PageGetByRoleOptions
/// <summary>
/// <para>
/// An attribute that is usually set by <c>aria-pressed</c>. Available values for pressed
/// are <c>true</c>, <c>false</c> and <c>"mixed"</c>.
/// Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>. By default, matching is case-insensitive and searches for a substring,
/// use <paramref name="exact"/> to control this behavior.
/// </para>
/// <para>
/// Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible
/// name</a>.
/// </para>
/// </summary>
[JsonPropertyName("nameString")]
public string? NameString { get; set; }
/// <summary>
/// <para>An attribute that is usually set by <c>aria-pressed</c>.</para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-pressed"><c>aria-pressed</c></a>.</para>
/// </summary>
[JsonPropertyName("pressed")]
public bool? Pressed { get; set; }
/// <summary>
/// <para>A boolean attribute that is usually set by <c>aria-selected</c>.</para>
/// <para>An attribute that is usually set by <c>aria-selected</c>.</para>
/// <para>Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-selected"><c>aria-selected</c></a>.</para>
/// </summary>
[JsonPropertyName("selected")]

Просмотреть файл

@ -41,8 +41,9 @@ public class PageLocatorOptions
}
Has = clone.Has;
HasTextString = clone.HasTextString;
HasText = clone.HasText;
HasTextRegex = clone.HasTextRegex;
HasTextString = clone.HasTextString;
}
/// <summary>
@ -66,8 +67,8 @@ public class PageLocatorOptions
/// and searches for a substring. For example, <c>"Playwright"</c> matches <c>&lt;article&gt;&lt;div&gt;Playwright&lt;/div&gt;&lt;/article&gt;</c>.
/// </para>
/// </summary>
[JsonPropertyName("hasTextString")]
public string? HasTextString { get; set; }
[JsonPropertyName("hasText")]
public string? HasText { get; set; }
/// <summary>
/// <para>
@ -78,6 +79,16 @@ public class PageLocatorOptions
/// </summary>
[JsonPropertyName("hasTextRegex")]
public Regex? HasTextRegex { get; set; }
/// <summary>
/// <para>
/// Matches elements containing specified text somewhere inside, possibly in a child
/// or a descendant element. When passed a <see cref="string"/>, matching is case-insensitive
/// and searches for a substring. For example, <c>"Playwright"</c> matches <c>&lt;article&gt;&lt;div&gt;Playwright&lt;/div&gt;&lt;/article&gt;</c>.
/// </para>
/// </summary>
[JsonPropertyName("hasTextString")]
public string? HasTextString { get; set; }
}
#nullable disable

Просмотреть файл

@ -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;
}
/// <summary>
@ -73,8 +74,8 @@ public class PageRouteFromHAROptions
/// all requests are served from the HAR file.
/// </para>
/// </summary>
[JsonPropertyName("urlString")]
public string? UrlString { get; set; }
[JsonPropertyName("url")]
public string? Url { get; set; }
/// <summary>
/// <para>
@ -85,6 +86,16 @@ public class PageRouteFromHAROptions
/// </summary>
[JsonPropertyName("urlRegex")]
public Regex? UrlRegex { get; set; }
/// <summary>
/// <para>
/// 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.
/// </para>
/// </summary>
[JsonPropertyName("urlString")]
public string? UrlString { get; set; }
}
#nullable disable

Просмотреть файл

@ -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.
/// </para>
/// </summary>
[JsonPropertyName("urlString")]
public string? UrlString { get; set; }
[JsonPropertyName("url")]
public string? Url { get; set; }
/// <summary>
/// <para>
/// A glob pattern, regex pattern or predicate receiving <see cref="URL"/> 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.
/// </para>
/// </summary>
[JsonPropertyName("urlFunc")]
public Func<string, bool>? UrlFunc { get; set; }
/// <summary>
/// <para>
@ -89,8 +101,8 @@ public class PageRunAndWaitForNavigationOptions
/// equal to the string.
/// </para>
/// </summary>
[JsonPropertyName("urlFunc")]
public Func<string, bool>? UrlFunc { get; set; }
[JsonPropertyName("urlString")]
public string? UrlString { get; set; }
/// <summary>
/// <para>When to consider operation succeeded, defaults to <c>load</c>. Events can be either:</para>

Просмотреть файл

@ -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.
/// </para>
/// </summary>
[JsonPropertyName("urlString")]
public string? UrlString { get; set; }
[JsonPropertyName("url")]
public string? Url { get; set; }
/// <summary>
/// <para>
/// A glob pattern, regex pattern or predicate receiving <see cref="URL"/> 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.
/// </para>
/// </summary>
[JsonPropertyName("urlFunc")]
public Func<string, bool>? UrlFunc { get; set; }
/// <summary>
/// <para>
@ -89,8 +101,8 @@ public class PageWaitForNavigationOptions
/// equal to the string.
/// </para>
/// </summary>
[JsonPropertyName("urlFunc")]
public Func<string, bool>? UrlFunc { get; set; }
[JsonPropertyName("urlString")]
public string? UrlString { get; set; }
/// <summary>
/// <para>When to consider operation succeeded, defaults to <c>load</c>. Events can be either:</para>

Просмотреть файл

@ -65,7 +65,7 @@ internal class APIRequestContext : ChannelOwnerBase, IChannelOwner<APIRequestCon
{
options.Headers = await urlOrRequest.AllHeadersAsync().ConfigureAwait(false);
}
if (options.DataByte == null && options.DataObject == null && options.DataString == null && options.Form == null && options.Multipart == null)
if (options.Data == null && options.DataByte == null && options.DataObject == null && options.DataString == null && options.Form == null && options.Multipart == null)
{
options.DataByte = urlOrRequest.PostDataBuffer;
}
@ -80,7 +80,7 @@ internal class APIRequestContext : ChannelOwnerBase, IChannelOwner<APIRequestCon
{
throw new PlaywrightException("'maxRedirects' should be greater than or equal to '0'");
}
if (new[] { options.DataByte, options.DataObject, options.DataString, options.Form, options.Multipart }.Count(x => 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<APIRequestCon
}
byte[] postData = null;
object jsonData = null;
if (!string.IsNullOrEmpty(options.DataString))
string dataString = !string.IsNullOrEmpty(options.Data) ? options.Data : options.DataString;
if (!string.IsNullOrEmpty(dataString))
{
if (IsJsonContentType(options.Headers?.ToDictionary(x => 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)

Просмотреть файл

@ -116,6 +116,7 @@ internal class Browser : ChannelOwnerBase, IChannelOwner<Browser>, 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<Browser>, IBrowser
RecordHarContent = options.RecordHarContent,
RecordHarMode = options.RecordHarMode,
RecordHarOmitContent = options.RecordHarOmitContent,
RecordHarUrlFilter = options.RecordHarUrlFilter,
RecordHarUrlFilterString = options.RecordHarUrlFilterString,
RecordHarUrlFilterRegex = options.RecordHarUrlFilterRegex,
RecordVideoDir = options.RecordVideoDir,

Просмотреть файл

@ -542,6 +542,7 @@ internal class BrowserContext : ChannelOwnerBase, IChannelOwner<BrowserContext>,
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<BrowserContext>,
}
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);

Просмотреть файл

@ -124,6 +124,7 @@ internal class BrowserType : ChannelOwnerBase, IChannelOwner<BrowserType>, 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<BrowserType>, IBrow
RecordHarMode = options.RecordHarMode,
RecordHarOmitContent = options.RecordHarOmitContent,
RecordHarPath = options.RecordHarPath,
RecordHarUrlFilter = options.RecordHarUrlFilter,
RecordHarUrlFilterString = options.RecordHarUrlFilterString,
RecordHarUrlFilterRegex = options.RecordHarUrlFilterRegex,
};

Просмотреть файл

@ -199,7 +199,8 @@ internal class Frame : ChannelOwnerBase, IChannelOwner<Frame>, 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<Frame>, 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<Frame>, 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<Frame>, IFrame
new Locator(this, selector, new()
{
Has = options?.Has,
HasText = options?.HasText,
HasTextString = options?.HasTextString,
HasTextRegex = options?.HasTextRegex,
});

Просмотреть файл

@ -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}");
}

Просмотреть файл

@ -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; }

Просмотреть файл

@ -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<string> { "level", options.Level.ToString() });
}
if (options.NameString != null)
if (options.Name != null)
{
props.Add(new List<string> { "name", EscapeForAttributeSelector(options.Name, false) });
}
else if (options.NameString != null)
{
props.Add(new List<string> { "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; }

Просмотреть файл

@ -326,6 +326,7 @@ internal class Page : ChannelOwnerBase, IChannelOwner<Page>, IPage
public Task<IResponse> 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<Page>, IPage
public Task<IResponse> RunAndWaitForNavigationAsync(Func<Task> 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<Page>, 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<Page>, 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<Page>, 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);

Просмотреть файл

@ -48,6 +48,7 @@ internal class BrowserChannel : Channel<Browser>
HarMode? recordHarMode,
string recordHarPath,
bool? recordHarOmitContent,
string recordHarUrlFilter,
string recordHarUrlFilterString,
Regex recordHarUrlFilterRegex)
{
@ -65,7 +66,11 @@ internal class BrowserChannel : Channel<Browser>
{
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<Browser>
HarMode? recordHarMode = default,
string recordHarPath = default,
bool? recordHarOmitContent = default,
string recordHarUrlFilter = default,
string recordHarUrlFilterString = default,
Regex recordHarUrlFilterRegex = default,
Dictionary<string, object> recordVideo = null,
@ -165,6 +171,7 @@ internal class BrowserChannel : Channel<Browser>
recordHarMode: recordHarMode,
recordHarPath: recordHarPath,
recordHarOmitContent: recordHarOmitContent,
recordHarUrlFilter: recordHarUrlFilter,
recordHarUrlFilterString: recordHarUrlFilterString,
recordHarUrlFilterRegex: recordHarUrlFilterRegex);
if (recordHarOptions != null)

Просмотреть файл

@ -247,13 +247,14 @@ internal class BrowserContextChannel : Channel<BrowserContext>
internal async Task<string> HarStartAsync(
Page page,
string path,
string recordHarUrlFilter,
string recordHarUrlFilterString,
Regex recordHarUrlFilterRegex)
{
var args = new Dictionary<string, object>
{
{ "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,

Просмотреть файл

@ -125,6 +125,7 @@ internal class BrowserTypeChannel : Channel<Core.BrowserType>
HarMode? recordHarMode = default,
string recordHarPath = default,
bool? recordHarOmitContent = default,
string recordHarUrlFilter = default,
string recordHarUrlFilterString = default,
Regex recordHarUrlFilterRegex = default,
Dictionary<string, object> recordVideo = default,
@ -164,6 +165,7 @@ internal class BrowserTypeChannel : Channel<Core.BrowserType>
recordHarMode: recordHarMode,
recordHarPath: recordHarPath,
recordHarOmitContent: recordHarOmitContent,
recordHarUrlFilter: recordHarUrlFilter,
recordHarUrlFilterString: recordHarUrlFilterString,
recordHarUrlFilterRegex: recordHarUrlFilterRegex);
if (recordHarOptions != null)