api(dotnet): remove whenall (#6768)
This commit is contained in:
parent
9f3e66566b
commit
fb3c6e50d4
|
|
@ -1425,10 +1425,12 @@ with frame.expect_navigation():
|
|||
```
|
||||
|
||||
```csharp
|
||||
await Task.WhenAll(
|
||||
frame.WaitForNavigationAsync(),
|
||||
// clicking the link will indirectly cause a navigation
|
||||
frame.ClickAsync("a.delayed-navigation"));
|
||||
await frame.RunAndWaitForNavigationAsync(async () =>
|
||||
{
|
||||
// Clicking the link will indirectly cause a navigation.
|
||||
await frame.ClickAsync("a.delayed-navigation"));
|
||||
});
|
||||
|
||||
// Resolves after navigation has finished
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -3273,8 +3273,12 @@ with page.expect_navigation():
|
|||
```
|
||||
|
||||
```csharp
|
||||
await Task.WhenAll(page.WaitForNavigationAsync(),
|
||||
frame.ClickAsync("a.delayed-navigation")); // clicking the link will indirectly cause a navigation
|
||||
await page.RunAndWaitForNavigationAsync(async () =>
|
||||
{
|
||||
// Clicking the link will indirectly cause a navigation.
|
||||
await page.ClickAsync("a.delayed-navigation"));
|
||||
});
|
||||
|
||||
// The method continues after navigation has finished
|
||||
```
|
||||
|
||||
|
|
@ -3336,7 +3340,7 @@ const [request] = await Promise.all([
|
|||
```
|
||||
|
||||
```java
|
||||
// Waits for the next response with the specified url
|
||||
// Waits for the next request with the specified url
|
||||
Request request = page.waitForRequest("https://example.com/resource", () -> {
|
||||
// Triggers the request
|
||||
page.click("button.triggers-request");
|
||||
|
|
@ -3372,17 +3376,17 @@ second_request = second.value
|
|||
```
|
||||
|
||||
```csharp
|
||||
// Waits for the next response with the specified url
|
||||
await Task.WhenAll(page.WaitForRequestAsync("https://example.com/resource"),
|
||||
page.ClickAsync("button.triggers-request"));
|
||||
// Waits for the next request with the specified url.
|
||||
await page.RunAndWaitForRequestAsync(async () =>
|
||||
{
|
||||
await page.ClickAsync("button");
|
||||
}, "http://example.com/resource");
|
||||
|
||||
// Waits for the next request matching some conditions
|
||||
await Task.WhenAll(page.WaitForRequestAsync(r => "https://example.com".Equals(r.Url) && "GET" == r.Method),
|
||||
page.ClickAsync("button.triggers-request"));
|
||||
```
|
||||
|
||||
```js
|
||||
await page.waitForRequest(request => request.url().searchParams.get('foo') === 'bar' && request.url().searchParams.get('foo2') === 'bar2');
|
||||
// Alternative way with a predicate.
|
||||
await page.RunAndWaitForRequestAsync(async () =>
|
||||
{
|
||||
await page.ClickAsync("button");
|
||||
}, request => request.Url == "https://example.com" && request.Method == "GET");
|
||||
```
|
||||
|
||||
### param: Page.waitForRequest.action = %%-csharp-wait-for-event-action-%%
|
||||
|
|
@ -3491,13 +3495,17 @@ return response.ok
|
|||
```
|
||||
|
||||
```csharp
|
||||
// Waits for the next response with the specified url
|
||||
await Task.WhenAll(page.WaitForResponseAsync("https://example.com/resource"),
|
||||
page.ClickAsync("button.triggers-response"));
|
||||
// Waits for the next response with the specified url.
|
||||
await page.RunAndWaitForResponseAsync(async () =>
|
||||
{
|
||||
await page.ClickAsync("button.triggers-response");
|
||||
}, "http://example.com/resource");
|
||||
|
||||
// Waits for the next response matching some conditions
|
||||
await Task.WhenAll(page.WaitForResponseAsync(r => "https://example.com".Equals(r.Url) && r.Status == 200),
|
||||
page.ClickAsync("button.triggers-response"));
|
||||
// Alternative way with a predicate.
|
||||
await page.RunAndWaitForResponseAsync(async () =>
|
||||
{
|
||||
await page.ClickAsync("button");
|
||||
}, response => response.Url == "https://example.com" && response.Status == 200);
|
||||
```
|
||||
|
||||
### param: Page.waitForResponse.action = %%-csharp-wait-for-event-action-%%
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ Receives the [WebSocketFrame] object and resolves to truthy value when the waiti
|
|||
## async method: WebSocket.waitForEvent2
|
||||
* langs: python
|
||||
- alias-python: wait_for_event
|
||||
- alias-csharp: WaitForEventAsync
|
||||
- returns: <[any]>
|
||||
|
||||
:::note
|
||||
|
|
|
|||
|
|
@ -492,12 +492,6 @@ A glob pattern, regex pattern or predicate receiving [URL] to match while waitin
|
|||
|
||||
Event name, same one typically passed into `*.on(event)`.
|
||||
|
||||
## csharp-wait-for-event-event
|
||||
* langs: csharp
|
||||
- `playwrightEvent` <[PlaywrightEvent<T>]>
|
||||
|
||||
Event type, same one typically passed into `WaitForEventAsync`.
|
||||
|
||||
## wait-for-load-state-state
|
||||
- `state` <[LoadState]<"load"|"domcontentloaded"|"networkidle">>
|
||||
|
||||
|
|
|
|||
|
|
@ -344,10 +344,11 @@ with page.expect_navigation():
|
|||
```csharp
|
||||
// Using waitForNavigation with a callback prevents a race condition
|
||||
// between clicking and waiting for a navigation.
|
||||
await Task.WhenAll(
|
||||
page.WaitForNavigationAsync(), // Waits for the next navigation
|
||||
page.ClickAsync("div.delayed-navigation"); // Triggers a navigation after a timeout
|
||||
);
|
||||
await page.RunAndWaitForNavigationAsync(async () =>
|
||||
{
|
||||
// Triggers a navigation after a timeout
|
||||
await page.ClickAsync("div.delayed-navigation");
|
||||
});
|
||||
```
|
||||
|
||||
### Multiple navigations
|
||||
|
|
@ -393,10 +394,14 @@ with page.expect_navigation(url="**/login"):
|
|||
```csharp
|
||||
// Running action in the callback of waitForNavigation prevents a race
|
||||
// condition between clicking and waiting for a navigation.
|
||||
await Task.WhenAll(
|
||||
page.WaitForNavigationAsync(new PageWaitForNavigationOptions { UrlString = "**/login" }), // Waits for the next navigation
|
||||
page.ClickAsync("a") // Triggers a navigation with a script redirect
|
||||
);
|
||||
await page.RunAndWaitForNavigationAsync(async () =>
|
||||
{
|
||||
// Triggers a navigation with a script redirect.
|
||||
await page.ClickAsync("a");
|
||||
}, new PageWaitForNavigationOptions
|
||||
{
|
||||
UrlString = "**/login"
|
||||
});
|
||||
```
|
||||
|
||||
### Loading a popup
|
||||
|
|
|
|||
4
types/types.d.ts
vendored
4
types/types.d.ts
vendored
|
|
@ -3173,10 +3173,6 @@ export interface Page {
|
|||
* ]);
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* await page.waitForRequest(request => request.url().searchParams.get('foo') === 'bar' && request.url().searchParams.get('foo2') === 'bar2');
|
||||
* ```
|
||||
*
|
||||
* @param urlOrPredicate Request URL string, regex or predicate receiving [Request] object.
|
||||
* @param options
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue