@@ -1874,18 +1874,12 @@ <h2 id="returns">Returns</h2>
1874
1874
`predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if browser context
1875
1875
is closed before the `event` is fired.
1876
1876
1877
- ```python async
1877
+ ```py
1878
1878
async with context.expect_event("page") as event_info:
1879
1879
await context.click("button")
1880
1880
page = await event_info.value
1881
1881
```
1882
1882
1883
- ```python sync
1884
- with context.expect_event("page") as event_info:
1885
- context.click("button")
1886
- page = event_info.value
1887
- ```
1888
-
1889
1883
Parameters
1890
1884
----------
1891
1885
event : str
@@ -2248,15 +2242,9 @@ <h2 id="returns">Returns</h2>
2248
2242
<p>Performs action and waits for given <code>event</code> to fire. If predicate is provided, it passes event's value into the
2249
2243
<code>predicate</code> function and waits for <code>predicate(event)</code> to return a truthy value. Will throw an error if browser context
2250
2244
is closed before the <code>event</code> is fired.</p>
2251
- <p>```python async
2252
- async with context.expect_event("page") as event_info:
2253
- await context.click("button")
2254
- page = await event_info.value</p>
2255
- <pre><code>
2256
- ```python sync
2257
- with context.expect_event("page") as event_info:
2258
- context.click("button")
2259
- page = event_info.value
2245
+ <pre><code class="language-py">async with context.expect_event("page") as event_info:
2246
+ await context.click("button")
2247
+ page = await event_info.value
2260
2248
</code></pre>
2261
2249
<h2 id="parameters">Parameters</h2>
2262
2250
<dl>
@@ -2286,18 +2274,12 @@ <h2 id="returns">Returns</h2>
2286
2274
`predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if browser context
2287
2275
is closed before the `event` is fired.
2288
2276
2289
- ```python async
2277
+ ```py
2290
2278
async with context.expect_event("page") as event_info:
2291
2279
await context.click("button")
2292
2280
page = await event_info.value
2293
2281
```
2294
2282
2295
- ```python sync
2296
- with context.expect_event("page") as event_info:
2297
- context.click("button")
2298
- page = event_info.value
2299
- ```
2300
-
2301
2283
Parameters
2302
2284
----------
2303
2285
event : str
@@ -10926,18 +10908,12 @@ <h3>Class variables</h3>
10926
10908
cause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation from a `setTimeout`.
10927
10909
Consider this example:
10928
10910
10929
- ```python async
10911
+ ```py
10930
10912
async with frame.expect_navigation():
10931
10913
await frame.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation
10932
10914
# Context manager waited for the navigation to happen.
10933
10915
```
10934
10916
10935
- ```python sync
10936
- with frame.expect_navigation():
10937
- frame.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation
10938
- # Context manager waited for the navigation to happen.
10939
- ```
10940
-
10941
10917
> NOTE: Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is
10942
10918
considered a navigation.
10943
10919
@@ -12066,14 +12042,8 @@ <h2 id="returns">Returns</h2>
12066
12042
<p>This resolves when the page navigates to a new URL or reloads. It is useful for when you run code which will indirectly
12067
12043
cause the page to navigate. e.g. The click target has an <code>onclick</code> handler that triggers navigation from a <code>setTimeout</code>.
12068
12044
Consider this example:</p>
12069
- <p>```python async
12070
- async with frame.expect_navigation():
12071
- await frame.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation</p>
12072
- <h1 id="context-manager-waited-for-the-navigation-to-happen">Context manager waited for the navigation to happen.</h1>
12073
- <pre><code>
12074
- ```python sync
12075
- with frame.expect_navigation():
12076
- frame.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation
12045
+ <pre><code class="language-py">async with frame.expect_navigation():
12046
+ await frame.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation
12077
12047
# Context manager waited for the navigation to happen.
12078
12048
</code></pre>
12079
12049
<blockquote>
@@ -12120,18 +12090,12 @@ <h2 id="returns">Returns</h2>
12120
12090
cause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation from a `setTimeout`.
12121
12091
Consider this example:
12122
12092
12123
- ```python async
12093
+ ```py
12124
12094
async with frame.expect_navigation():
12125
12095
await frame.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation
12126
12096
# Context manager waited for the navigation to happen.
12127
12097
```
12128
12098
12129
- ```python sync
12130
- with frame.expect_navigation():
12131
- frame.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation
12132
- # Context manager waited for the navigation to happen.
12133
- ```
12134
-
12135
12099
> NOTE: Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is
12136
12100
considered a navigation.
12137
12101
@@ -18618,18 +18582,12 @@ <h2 id="parameters">Parameters</h2>
18618
18582
`predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the page is
18619
18583
closed before the `event` is fired.
18620
18584
18621
- ```python async
18585
+ ```py
18622
18586
async with page.expect_event(event_name) as event_info:
18623
18587
await page.click("button")
18624
18588
value = await event_info.value
18625
18589
```
18626
18590
18627
- ```python sync
18628
- with page.expect_event(event_name) as event_info:
18629
- page.click("button")
18630
- value = event_info.value
18631
- ```
18632
-
18633
18591
Parameters
18634
18592
----------
18635
18593
event : str
@@ -18752,18 +18710,12 @@ <h2 id="parameters">Parameters</h2>
18752
18710
cause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation from a `setTimeout`.
18753
18711
Consider this example:
18754
18712
18755
- ```python async
18713
+ ```py
18756
18714
async with page.expect_navigation():
18757
18715
await page.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation
18758
18716
# Context manager waited for the navigation to happen.
18759
18717
```
18760
18718
18761
- ```python sync
18762
- with page.expect_navigation():
18763
- page.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation
18764
- # Context manager waited for the navigation to happen.
18765
- ```
18766
-
18767
18719
> NOTE: Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is
18768
18720
considered a navigation.
18769
18721
@@ -20473,15 +20425,9 @@ <h2 id="returns">Returns</h2>
20473
20425
<p>Performs action and waits for given <code>event</code> to fire. If predicate is provided, it passes event's value into the
20474
20426
<code>predicate</code> function and waits for <code>predicate(event)</code> to return a truthy value. Will throw an error if the page is
20475
20427
closed before the <code>event</code> is fired.</p>
20476
- <p>```python async
20477
- async with page.expect_event(event_name) as event_info:
20478
- await page.click("button")
20479
- value = await event_info.value</p>
20480
- <pre><code>
20481
- ```python sync
20482
- with page.expect_event(event_name) as event_info:
20483
- page.click("button")
20484
- value = event_info.value
20428
+ <pre><code class="language-py">async with page.expect_event(event_name) as event_info:
20429
+ await page.click("button")
20430
+ value = await event_info.value
20485
20431
</code></pre>
20486
20432
<h2 id="parameters">Parameters</h2>
20487
20433
<dl>
@@ -20511,18 +20457,12 @@ <h2 id="returns">Returns</h2>
20511
20457
`predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the page is
20512
20458
closed before the `event` is fired.
20513
20459
20514
- ```python async
20460
+ ```py
20515
20461
async with page.expect_event(event_name) as event_info:
20516
20462
await page.click("button")
20517
20463
value = await event_info.value
20518
20464
```
20519
20465
20520
- ```python sync
20521
- with page.expect_event(event_name) as event_info:
20522
- page.click("button")
20523
- value = event_info.value
20524
- ```
20525
-
20526
20466
Parameters
20527
20467
----------
20528
20468
event : str
@@ -20609,14 +20549,8 @@ <h2 id="returns">Returns</h2>
20609
20549
<p>This resolves when the page navigates to a new URL or reloads. It is useful for when you run code which will indirectly
20610
20550
cause the page to navigate. e.g. The click target has an <code>onclick</code> handler that triggers navigation from a <code>setTimeout</code>.
20611
20551
Consider this example:</p>
20612
- <p>```python async
20613
- async with page.expect_navigation():
20614
- await page.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation</p>
20615
- <h1 id="context-manager-waited-for-the-navigation-to-happen">Context manager waited for the navigation to happen.</h1>
20616
- <pre><code>
20617
- ```python sync
20618
- with page.expect_navigation():
20619
- page.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation
20552
+ <pre><code class="language-py">async with page.expect_navigation():
20553
+ await page.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation
20620
20554
# Context manager waited for the navigation to happen.
20621
20555
</code></pre>
20622
20556
<blockquote>
@@ -20664,18 +20598,12 @@ <h2 id="returns">Returns</h2>
20664
20598
cause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation from a `setTimeout`.
20665
20599
Consider this example:
20666
20600
20667
- ```python async
20601
+ ```py
20668
20602
async with page.expect_navigation():
20669
20603
await page.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation
20670
20604
# Context manager waited for the navigation to happen.
20671
20605
```
20672
20606
20673
- ```python sync
20674
- with page.expect_navigation():
20675
- page.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation
20676
- # Context manager waited for the navigation to happen.
20677
- ```
20678
-
20679
20607
> NOTE: Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is
20680
20608
considered a navigation.
20681
20609
@@ -26899,18 +26827,12 @@ <h3>Class variables</h3>
26899
26827
`predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the socket is
26900
26828
closed before the `event` is fired.
26901
26829
26902
- ```python async
26830
+ ```py
26903
26831
async with ws.expect_event(event_name) as event_info:
26904
26832
await ws.click("button")
26905
26833
value = await event_info.value
26906
26834
```
26907
26835
26908
- ```python sync
26909
- with ws.expect_event(event_name) as event_info:
26910
- ws.click("button")
26911
- value = event_info.value
26912
- ```
26913
-
26914
26836
Parameters
26915
26837
----------
26916
26838
event : str
@@ -26993,15 +26915,9 @@ <h3>Methods</h3>
26993
26915
<p>Performs action and waits for given <code>event</code> to fire. If predicate is provided, it passes event's value into the
26994
26916
<code>predicate</code> function and waits for <code>predicate(event)</code> to return a truthy value. Will throw an error if the socket is
26995
26917
closed before the <code>event</code> is fired.</p>
26996
- <p>```python async
26997
- async with ws.expect_event(event_name) as event_info:
26998
- await ws.click("button")
26999
- value = await event_info.value</p>
27000
- <pre><code>
27001
- ```python sync
27002
- with ws.expect_event(event_name) as event_info:
27003
- ws.click("button")
27004
- value = event_info.value
26918
+ <pre><code class="language-py">async with ws.expect_event(event_name) as event_info:
26919
+ await ws.click("button")
26920
+ value = await event_info.value
27005
26921
</code></pre>
27006
26922
<h2 id="parameters">Parameters</h2>
27007
26923
<dl>
@@ -27031,18 +26947,12 @@ <h2 id="returns">Returns</h2>
27031
26947
`predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the socket is
27032
26948
closed before the `event` is fired.
27033
26949
27034
- ```python async
26950
+ ```py
27035
26951
async with ws.expect_event(event_name) as event_info:
27036
26952
await ws.click("button")
27037
26953
value = await event_info.value
27038
26954
```
27039
26955
27040
- ```python sync
27041
- with ws.expect_event(event_name) as event_info:
27042
- ws.click("button")
27043
- value = event_info.value
27044
- ```
27045
-
27046
26956
Parameters
27047
26957
----------
27048
26958
event : str
0 commit comments