@@ -534,6 +534,54 @@ <h1 class="title">Module <code>playwright.async_api</code></h1>
534
534
"""
535
535
return mapping.from_maybe_impl(self._impl_obj.url)
536
536
537
+ async def waitForEvent(
538
+ self,
539
+ event: str,
540
+ predicate: typing.Union[typing.Callable[[typing.Any], bool]] = None,
541
+ timeout: int = None,
542
+ ) -> typing.Any:
543
+ """WebSocket.waitForEvent
544
+
545
+ Waits for event to fire and passes its value into the predicate function. Resolves when the predicate returns truthy value. Will throw an error if the webSocket is closed before the event
546
+ is fired.
547
+
548
+ Parameters
549
+ ----------
550
+ event : str
551
+ Event name, same one would pass into `webSocket.on(event)`.
552
+
553
+ Returns
554
+ -------
555
+ Any
556
+ Promise which resolves to the event data value.
557
+ """
558
+ return mapping.from_maybe_impl(
559
+ await self._impl_obj.waitForEvent(
560
+ event=event, predicate=self._wrap_handler(predicate), timeout=timeout
561
+ )
562
+ )
563
+
564
+ def expect_event(
565
+ self,
566
+ event: str,
567
+ predicate: typing.Union[typing.Callable[[typing.Any], bool]] = None,
568
+ timeout: int = None,
569
+ ) -> AsyncEventContextManager:
570
+ return AsyncEventContextManager(
571
+ self._impl_obj.waitForEvent(event, predicate, timeout)
572
+ )
573
+
574
+ def isClosed(self) -> bool:
575
+ """WebSocket.isClosed
576
+
577
+ Indicates that the web socket has been closed.
578
+
579
+ Returns
580
+ -------
581
+ bool
582
+ """
583
+ return mapping.from_maybe_impl(self._impl_obj.isClosed())
584
+
537
585
538
586
mapping.register(WebSocketImpl, WebSocket)
539
587
@@ -24543,7 +24591,55 @@ <h2 id="returns">Returns</h2>
24543
24591
-------
24544
24592
str
24545
24593
"""
24546
- return mapping.from_maybe_impl(self._impl_obj.url)</code></pre>
24594
+ return mapping.from_maybe_impl(self._impl_obj.url)
24595
+
24596
+ async def waitForEvent(
24597
+ self,
24598
+ event: str,
24599
+ predicate: typing.Union[typing.Callable[[typing.Any], bool]] = None,
24600
+ timeout: int = None,
24601
+ ) -> typing.Any:
24602
+ """WebSocket.waitForEvent
24603
+
24604
+ Waits for event to fire and passes its value into the predicate function. Resolves when the predicate returns truthy value. Will throw an error if the webSocket is closed before the event
24605
+ is fired.
24606
+
24607
+ Parameters
24608
+ ----------
24609
+ event : str
24610
+ Event name, same one would pass into `webSocket.on(event)`.
24611
+
24612
+ Returns
24613
+ -------
24614
+ Any
24615
+ Promise which resolves to the event data value.
24616
+ """
24617
+ return mapping.from_maybe_impl(
24618
+ await self._impl_obj.waitForEvent(
24619
+ event=event, predicate=self._wrap_handler(predicate), timeout=timeout
24620
+ )
24621
+ )
24622
+
24623
+ def expect_event(
24624
+ self,
24625
+ event: str,
24626
+ predicate: typing.Union[typing.Callable[[typing.Any], bool]] = None,
24627
+ timeout: int = None,
24628
+ ) -> AsyncEventContextManager:
24629
+ return AsyncEventContextManager(
24630
+ self._impl_obj.waitForEvent(event, predicate, timeout)
24631
+ )
24632
+
24633
+ def isClosed(self) -> bool:
24634
+ """WebSocket.isClosed
24635
+
24636
+ Indicates that the web socket has been closed.
24637
+
24638
+ Returns
24639
+ -------
24640
+ bool
24641
+ """
24642
+ return mapping.from_maybe_impl(self._impl_obj.isClosed())</code></pre>
24547
24643
</details>
24548
24644
<h3>Ancestors</h3>
24549
24645
<ul class="hlist">
@@ -24579,6 +24675,105 @@ <h2 id="returns">Returns</h2>
24579
24675
</details>
24580
24676
</dd>
24581
24677
</dl>
24678
+ <h3>Methods</h3>
24679
+ <dl>
24680
+ <dt id="playwright.async_api.WebSocket.expect_event"><code class="name flex">
24681
+ <span>def <span class="ident">expect_event</span></span>(<span>self, event: str, predicate: Callable[[Any], bool] = None, timeout: int = None) ‑> playwright.async_base.AsyncEventContextManager</span>
24682
+ </code></dt>
24683
+ <dd>
24684
+ <div class="desc"></div>
24685
+ <details class="source">
24686
+ <summary>
24687
+ <span>Expand source code</span>
24688
+ </summary>
24689
+ <pre><code class="python">def expect_event(
24690
+ self,
24691
+ event: str,
24692
+ predicate: typing.Union[typing.Callable[[typing.Any], bool]] = None,
24693
+ timeout: int = None,
24694
+ ) -> AsyncEventContextManager:
24695
+ return AsyncEventContextManager(
24696
+ self._impl_obj.waitForEvent(event, predicate, timeout)
24697
+ )</code></pre>
24698
+ </details>
24699
+ </dd>
24700
+ <dt id="playwright.async_api.WebSocket.isClosed"><code class="name flex">
24701
+ <span>def <span class="ident">isClosed</span></span>(<span>self) ‑> bool</span>
24702
+ </code></dt>
24703
+ <dd>
24704
+ <div class="desc"><p>WebSocket.isClosed</p>
24705
+ <p>Indicates that the web socket has been closed.</p>
24706
+ <h2 id="returns">Returns</h2>
24707
+ <dl>
24708
+ <dt><code>bool</code></dt>
24709
+ <dd> </dd>
24710
+ </dl></div>
24711
+ <details class="source">
24712
+ <summary>
24713
+ <span>Expand source code</span>
24714
+ </summary>
24715
+ <pre><code class="python">def isClosed(self) -> bool:
24716
+ """WebSocket.isClosed
24717
+
24718
+ Indicates that the web socket has been closed.
24719
+
24720
+ Returns
24721
+ -------
24722
+ bool
24723
+ """
24724
+ return mapping.from_maybe_impl(self._impl_obj.isClosed())</code></pre>
24725
+ </details>
24726
+ </dd>
24727
+ <dt id="playwright.async_api.WebSocket.waitForEvent"><code class="name flex">
24728
+ <span>async def <span class="ident">waitForEvent</span></span>(<span>self, event: str, predicate: Callable[[Any], bool] = None, timeout: int = None) ‑> Any</span>
24729
+ </code></dt>
24730
+ <dd>
24731
+ <div class="desc"><p>WebSocket.waitForEvent</p>
24732
+ <p>Waits for event to fire and passes its value into the predicate function. Resolves when the predicate returns truthy value. Will throw an error if the webSocket is closed before the event
24733
+ is fired.</p>
24734
+ <h2 id="parameters">Parameters</h2>
24735
+ <dl>
24736
+ <dt><strong><code>event</code></strong> : <code>str</code></dt>
24737
+ <dd>Event name, same one would pass into <code>webSocket.on(event)</code>.</dd>
24738
+ </dl>
24739
+ <h2 id="returns">Returns</h2>
24740
+ <dl>
24741
+ <dt><code>Any</code></dt>
24742
+ <dd>Promise which resolves to the event data value.</dd>
24743
+ </dl></div>
24744
+ <details class="source">
24745
+ <summary>
24746
+ <span>Expand source code</span>
24747
+ </summary>
24748
+ <pre><code class="python">async def waitForEvent(
24749
+ self,
24750
+ event: str,
24751
+ predicate: typing.Union[typing.Callable[[typing.Any], bool]] = None,
24752
+ timeout: int = None,
24753
+ ) -> typing.Any:
24754
+ """WebSocket.waitForEvent
24755
+
24756
+ Waits for event to fire and passes its value into the predicate function. Resolves when the predicate returns truthy value. Will throw an error if the webSocket is closed before the event
24757
+ is fired.
24758
+
24759
+ Parameters
24760
+ ----------
24761
+ event : str
24762
+ Event name, same one would pass into `webSocket.on(event)`.
24763
+
24764
+ Returns
24765
+ -------
24766
+ Any
24767
+ Promise which resolves to the event data value.
24768
+ """
24769
+ return mapping.from_maybe_impl(
24770
+ await self._impl_obj.waitForEvent(
24771
+ event=event, predicate=self._wrap_handler(predicate), timeout=timeout
24772
+ )
24773
+ )</code></pre>
24774
+ </details>
24775
+ </dd>
24776
+ </dl>
24582
24777
</dd>
24583
24778
<dt id="playwright.async_api.Worker"><code class="flex name class">
24584
24779
<span>class <span class="ident">Worker</span></span>
@@ -25208,7 +25403,10 @@ <h4><code><a title="playwright.async_api.Video" href="#playwright.async_api.Vide
25208
25403
<li>
25209
25404
<h4><code><a title="playwright.async_api.WebSocket" href="#playwright.async_api.WebSocket">WebSocket</a></code></h4>
25210
25405
<ul class="">
25406
+ <li><code><a title="playwright.async_api.WebSocket.expect_event" href="#playwright.async_api.WebSocket.expect_event">expect_event</a></code></li>
25407
+ <li><code><a title="playwright.async_api.WebSocket.isClosed" href="#playwright.async_api.WebSocket.isClosed">isClosed</a></code></li>
25211
25408
<li><code><a title="playwright.async_api.WebSocket.url" href="#playwright.async_api.WebSocket.url">url</a></code></li>
25409
+ <li><code><a title="playwright.async_api.WebSocket.waitForEvent" href="#playwright.async_api.WebSocket.waitForEvent">waitForEvent</a></code></li>
25212
25410
</ul>
25213
25411
</li>
25214
25412
<li>
0 commit comments