diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md index 21b51acde8..922a7df3bf 100644 --- a/docs/src/api/class-page.md +++ b/docs/src/api/class-page.md @@ -3344,12 +3344,19 @@ await page.GetByRole("button", new() { Name = "Start here" }).ClickAsync(); Locator that triggers the handler. ### param: Page.addLocatorHandler.handler -* langs: js, python, csharp +* langs: js, python * since: v1.42 - `handler` <[function]> Function that should be run once [`param: locator`] appears. This function should get rid of the element that blocks actions like click. +### param: Page.addLocatorHandler.handler +* langs: csharp +* since: v1.42 +- `handler` <[function](): [Promise]> + +Function that should be run once [`param: locator`] appears. This function should get rid of the element that blocks actions like click. + ### param: Page.addLocatorHandler.handler * langs: java * since: v1.42 diff --git a/utils/doclint/generateDotnetApi.js b/utils/doclint/generateDotnetApi.js index 368740feb2..ed801b4057 100644 --- a/utils/doclint/generateDotnetApi.js +++ b/utils/doclint/generateDotnetApi.js @@ -709,6 +709,9 @@ function translateType(type, parent, generateNameCallback = t => t.name, optiona if (type.expression === '[null]|[Error]') return 'void'; + if (type.name == 'Promise' && type.templates?.[0].name === 'any') + return 'Task'; + if (type.union) { if (type.union[0].name === 'null' && type.union.length === 2) return translateType(type.union[1], parent, generateNameCallback, true, isReturnType); @@ -799,6 +802,8 @@ function translateType(type, parent, generateNameCallback = t => t.name, optiona if (returnType === null) throw new Error('Unexpected null as return type.'); + if (!argsList) + return `Func<${returnType}>`; return `Func<${argsList}, ${returnType}>`; } } diff --git a/utils/generate_types/test/test.ts b/utils/generate_types/test/test.ts index 0bffaab281..05ede91adf 100644 --- a/utils/generate_types/test/test.ts +++ b/utils/generate_types/test/test.ts @@ -154,6 +154,12 @@ playwright.chromium.launch().then(async browser => { return 'something random for no reason'; }); + await page.addLocatorHandler(page.locator(''), () => {}); + await page.addLocatorHandler(page.locator(''), () => 42); + await page.addLocatorHandler(page.locator(''), async () => { }); + await page.addLocatorHandler(page.locator(''), async () => 42); + await page.addLocatorHandler(page.locator(''), () => Promise.resolve(42)); + await page.keyboard.type('Hello'); // Types instantly await page.keyboard.type('World', { delay: 100 }); // Types slower, like a user