@@ -2126,6 +2126,10 @@ async def select_text(
2126
2126
This method waits for [actionability](https://playwright.dev/python/docs/actionability) checks, then focuses the element and selects all its text
2127
2127
content.
2128
2128
2129
+ If the element is inside the `<label>` element that has an associated
2130
+ [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), focuses and selects text in the
2131
+ control instead.
2132
+
2129
2133
Parameters
2130
2134
----------
2131
2135
force : Union[bool, NoneType]
@@ -2145,7 +2149,10 @@ async def select_text(
2145
2149
async def input_value(self, *, timeout: float = None) -> str:
2146
2150
"""ElementHandle.input_value
2147
2151
2148
- Returns `input.value` for `<input>` or `<textarea>` or `<select>` element. Throws for non-input elements.
2152
+ Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
2153
+
2154
+ Throws for non-input elements. However, if the element is inside the `<label>` element that has an associated
2155
+ [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), returns the value of the control.
2149
2156
2150
2157
Parameters
2151
2158
----------
@@ -2180,12 +2187,14 @@ async def set_input_files(
2180
2187
) -> NoneType:
2181
2188
"""ElementHandle.set_input_files
2182
2189
2183
- This method expects `elementHandle` to point to an
2184
- [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
2185
-
2186
2190
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
2187
2191
are resolved relative to the the current working directory. For empty array, clears the selected files.
2188
2192
2193
+ This method expects [`elementHandle`] to point to an
2194
+ [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). However, if the element is inside the
2195
+ `<label>` element that has an associated
2196
+ [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), targets the control instead.
2197
+
2189
2198
Parameters
2190
2199
----------
2191
2200
files : Union[List[Union[pathlib.Path, str]], List[{name: str, mimeType: str, buffer: bytes}], pathlib.Path, str, {name: str, mimeType: str, buffer: bytes}]
@@ -4775,7 +4784,10 @@ async def input_value(
4775
4784
) -> str:
4776
4785
"""Frame.input_value
4777
4786
4778
- Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element. Throws for non-input elements.
4787
+ Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
4788
+
4789
+ Throws for non-input elements. However, if the element is inside the `<label>` element that has an associated
4790
+ [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), returns the value of the control.
4779
4791
4780
4792
Parameters
4781
4793
----------
@@ -4820,12 +4832,14 @@ async def set_input_files(
4820
4832
) -> NoneType:
4821
4833
"""Frame.set_input_files
4822
4834
4823
- This method expects `selector` to point to an
4824
- [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
4825
-
4826
4835
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
4827
4836
are resolved relative to the the current working directory. For empty array, clears the selected files.
4828
4837
4838
+ This method expects `selector` to point to an
4839
+ [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). However, if the element is inside the
4840
+ `<label>` element that has an associated
4841
+ [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), targets the control instead.
4842
+
4829
4843
Parameters
4830
4844
----------
4831
4845
selector : str
@@ -7530,8 +7544,8 @@ async def goto(
7530
7544
) -> typing.Optional["Response"]:
7531
7545
"""Page.goto
7532
7546
7533
- Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
7534
- last redirect.
7547
+ Returns the main resource response. In case of multiple redirects, the navigation will resolve with the first
7548
+ non- redirect response .
7535
7549
7536
7550
The method will throw an error if:
7537
7551
- there's an SSL error (e.g. in case of self-signed certificates).
@@ -8977,7 +8991,10 @@ async def input_value(
8977
8991
) -> str:
8978
8992
"""Page.input_value
8979
8993
8980
- Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element. Throws for non-input elements.
8994
+ Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
8995
+
8996
+ Throws for non-input elements. However, if the element is inside the `<label>` element that has an associated
8997
+ [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), returns the value of the control.
8981
8998
8982
8999
Parameters
8983
9000
----------
@@ -9022,12 +9039,14 @@ async def set_input_files(
9022
9039
) -> NoneType:
9023
9040
"""Page.set_input_files
9024
9041
9025
- This method expects `selector` to point to an
9026
- [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
9027
-
9028
9042
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
9029
9043
are resolved relative to the the current working directory. For empty array, clears the selected files.
9030
9044
9045
+ This method expects `selector` to point to an
9046
+ [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). However, if the element is inside the
9047
+ `<label>` element that has an associated
9048
+ [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), targets the control instead.
9049
+
9031
9050
Parameters
9032
9051
----------
9033
9052
selector : str
@@ -12985,6 +13004,37 @@ def nth(self, index: int) -> "Locator":
12985
13004
12986
13005
return mapping.from_impl(self._impl_obj.nth(index=index))
12987
13006
13007
+ def that(
13008
+ self,
13009
+ *,
13010
+ has_text: typing.Union[str, typing.Pattern] = None,
13011
+ has: "Locator" = None
13012
+ ) -> "Locator":
13013
+ """Locator.that
13014
+
13015
+ This method narrows existing locator according to the options, for example filters by text.
13016
+
13017
+ Parameters
13018
+ ----------
13019
+ has_text : Union[Pattern, str, NoneType]
13020
+ Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a
13021
+ [string], matching is case-insensitive and searches for a substring. For example, `"Playwright"` matches
13022
+ `<article><div>Playwright</div></article>`.
13023
+ has : Union[Locator, NoneType]
13024
+ Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer one.
13025
+ For example, `article` that has `text=Playwright` matches `<article><div>Playwright</div></article>`.
13026
+
13027
+ Note that outer and inner locators must belong to the same frame. Inner locator must not contain `FrameLocator`s.
13028
+
13029
+ Returns
13030
+ -------
13031
+ Locator
13032
+ """
13033
+
13034
+ return mapping.from_impl(
13035
+ self._impl_obj.that(has_text=has_text, has=has._impl_obj if has else None)
13036
+ )
13037
+
12988
13038
async def focus(self, *, timeout: float = None) -> NoneType:
12989
13039
"""Locator.focus
12990
13040
@@ -13196,7 +13246,10 @@ async def inner_text(self, *, timeout: float = None) -> str:
13196
13246
async def input_value(self, *, timeout: float = None) -> str:
13197
13247
"""Locator.input_value
13198
13248
13199
- Returns `input.value` for `<input>` or `<textarea>` or `<select>` element. Throws for non-input elements.
13249
+ Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
13250
+
13251
+ Throws for non-input elements. However, if the element is inside the `<label>` element that has an associated
13252
+ [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), returns the value of the control.
13200
13253
13201
13254
Parameters
13202
13255
----------
@@ -13580,6 +13633,10 @@ async def select_text(
13580
13633
This method waits for [actionability](https://playwright.dev/python/docs/actionability) checks, then focuses the element and selects all its text
13581
13634
content.
13582
13635
13636
+ If the element is inside the `<label>` element that has an associated
13637
+ [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), focuses and selects text in the
13638
+ control instead.
13639
+
13583
13640
Parameters
13584
13641
----------
13585
13642
force : Union[bool, NoneType]
@@ -13611,12 +13668,14 @@ async def set_input_files(
13611
13668
) -> NoneType:
13612
13669
"""Locator.set_input_files
13613
13670
13614
- This method expects `element` to point to an
13615
- [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
13616
-
13617
13671
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
13618
13672
are resolved relative to the the current working directory. For empty array, clears the selected files.
13619
13673
13674
+ This method expects [`locator`] to point to an
13675
+ [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). However, if the element is inside the
13676
+ `<label>` element that has an associated
13677
+ [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), targets the control instead.
13678
+
13620
13679
Parameters
13621
13680
----------
13622
13681
files : Union[List[Union[pathlib.Path, str]], List[{name: str, mimeType: str, buffer: bytes}], pathlib.Path, str, {name: str, mimeType: str, buffer: bytes}]
@@ -15491,7 +15550,10 @@ async def not_to_be_checked(self, *, timeout: float = None) -> NoneType:
15491
15550
async def to_be_disabled(self, *, timeout: float = None) -> NoneType:
15492
15551
"""LocatorAssertions.to_be_disabled
15493
15552
15494
- Ensures the `Locator` points to a disabled element.
15553
+ Ensures the `Locator` points to a disabled element. Element is disabled if it has \"disabled\" attribute or is disabled
15554
+ via ['aria-disabled'](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled). Note
15555
+ that only native control elements such as HTML `button`, `input`, `select`, `textarea`, `option`, `optgroup` can be
15556
+ disabled by setting \"disabled\" attribute. \"disabled\" attribute on other elements is ignored by the browser.
15495
15557
15496
15558
```py
15497
15559
from playwright.async_api import expect
0 commit comments