cherry-pick(#30200): docs(java,csharp): add BrowserContext.backgroundPage(s)
This commit is contained in:
parent
7c7f8ac9fa
commit
acb6ff1d84
|
|
@ -64,7 +64,6 @@ await context.CloseAsync();
|
||||||
|
|
||||||
## event: BrowserContext.backgroundPage
|
## event: BrowserContext.backgroundPage
|
||||||
* since: v1.11
|
* since: v1.11
|
||||||
* langs: js, python
|
|
||||||
- argument: <[Page]>
|
- argument: <[Page]>
|
||||||
|
|
||||||
:::note
|
:::note
|
||||||
|
|
@ -73,6 +72,13 @@ Only works with Chromium browser's persistent context.
|
||||||
|
|
||||||
Emitted when new background page is created in the context.
|
Emitted when new background page is created in the context.
|
||||||
|
|
||||||
|
```java
|
||||||
|
Page backgroundPage = context.waitForBackgroundPage(() -> {
|
||||||
|
page.getByText("activate extension").click();
|
||||||
|
});
|
||||||
|
System.out.println(backgroundPage.evaluate("location.href"));
|
||||||
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const backgroundPage = await context.waitForEvent('backgroundpage');
|
const backgroundPage = await context.waitForEvent('backgroundpage');
|
||||||
```
|
```
|
||||||
|
|
@ -85,6 +91,14 @@ background_page = await context.wait_for_event("backgroundpage")
|
||||||
background_page = context.wait_for_event("backgroundpage")
|
background_page = context.wait_for_event("backgroundpage")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var backgroundPage = await context.RunAndWaitForBackgoundPageAsync(async =>
|
||||||
|
{
|
||||||
|
await page.GetByText("activate extension").ClickAsync();
|
||||||
|
});
|
||||||
|
Console.WriteLine(await backgroundPage.EvaluateAsync<string>("location.href"));
|
||||||
|
```
|
||||||
|
|
||||||
## event: BrowserContext.close
|
## event: BrowserContext.close
|
||||||
* since: v1.8
|
* since: v1.8
|
||||||
- argument: <[BrowserContext]>
|
- argument: <[BrowserContext]>
|
||||||
|
|
@ -441,7 +455,6 @@ Script to be evaluated in all pages in the browser context. Optional.
|
||||||
|
|
||||||
## method: BrowserContext.backgroundPages
|
## method: BrowserContext.backgroundPages
|
||||||
* since: v1.11
|
* since: v1.11
|
||||||
* langs: js, python
|
|
||||||
- returns: <[Array]<[Page]>>
|
- returns: <[Array]<[Page]>>
|
||||||
|
|
||||||
:::note
|
:::note
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue