Skip to content

Commit 4d69bdb

Browse files
authored
chore(roll): roll Playwright to 1.22.0-alpha-apr-27-2022 (microsoft#1273)
1 parent dbb6cc6 commit 4d69bdb

File tree

9 files changed

+242
-46
lines changed

9 files changed

+242
-46
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H
44

55
| | Linux | macOS | Windows |
66
| :--- | :---: | :---: | :---: |
7-
| Chromium <!-- GEN:chromium-version -->101.0.4951.15<!-- GEN:stop --> ||||
7+
| Chromium <!-- GEN:chromium-version -->101.0.4951.41<!-- GEN:stop --> ||||
88
| WebKit <!-- GEN:webkit-version -->15.4<!-- GEN:stop --> ||||
99
| Firefox <!-- GEN:firefox-version -->98.0.2<!-- GEN:stop --> ||||
1010

playwright/_impl/_locator.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,18 @@ def last(self) -> "Locator":
236236
def nth(self, index: int) -> "Locator":
237237
return Locator(self._frame, f"{self._selector} >> nth={index}")
238238

239+
def that(
240+
self,
241+
has_text: Union[str, Pattern] = None,
242+
has: "Locator" = None,
243+
) -> "Locator":
244+
return Locator(
245+
self._frame,
246+
self._selector,
247+
has_text=has_text,
248+
has=has,
249+
)
250+
239251
async def focus(self, timeout: float = None) -> None:
240252
params = locals_to_params(locals())
241253
return await self._frame.focus(self._selector, strict=True, **params)

playwright/async_api/_generated.py

Lines changed: 81 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,6 +2126,10 @@ async def select_text(
21262126
This method waits for [actionability](https://playwright.dev/python/docs/actionability) checks, then focuses the element and selects all its text
21272127
content.
21282128

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+
21292133
Parameters
21302134
----------
21312135
force : Union[bool, NoneType]
@@ -2145,7 +2149,10 @@ async def select_text(
21452149
async def input_value(self, *, timeout: float = None) -> str:
21462150
"""ElementHandle.input_value
21472151

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.
21492156

21502157
Parameters
21512158
----------
@@ -2180,12 +2187,14 @@ async def set_input_files(
21802187
) -> NoneType:
21812188
"""ElementHandle.set_input_files
21822189

2183-
This method expects `elementHandle` to point to an
2184-
[input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
2185-
21862190
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
21872191
are resolved relative to the the current working directory. For empty array, clears the selected files.
21882192

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+
21892198
Parameters
21902199
----------
21912200
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(
47754784
) -> str:
47764785
"""Frame.input_value
47774786

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.
47794791

47804792
Parameters
47814793
----------
@@ -4820,12 +4832,14 @@ async def set_input_files(
48204832
) -> NoneType:
48214833
"""Frame.set_input_files
48224834

4823-
This method expects `selector` to point to an
4824-
[input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
4825-
48264835
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
48274836
are resolved relative to the the current working directory. For empty array, clears the selected files.
48284837

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+
48294843
Parameters
48304844
----------
48314845
selector : str
@@ -7530,8 +7544,8 @@ async def goto(
75307544
) -> typing.Optional["Response"]:
75317545
"""Page.goto
75327546

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.
75357549

75367550
The method will throw an error if:
75377551
- there's an SSL error (e.g. in case of self-signed certificates).
@@ -8977,7 +8991,10 @@ async def input_value(
89778991
) -> str:
89788992
"""Page.input_value
89798993

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.
89818998

89828999
Parameters
89839000
----------
@@ -9022,12 +9039,14 @@ async def set_input_files(
90229039
) -> NoneType:
90239040
"""Page.set_input_files
90249041

9025-
This method expects `selector` to point to an
9026-
[input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
9027-
90289042
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
90299043
are resolved relative to the the current working directory. For empty array, clears the selected files.
90309044

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+
90319050
Parameters
90329051
----------
90339052
selector : str
@@ -12985,6 +13004,37 @@ def nth(self, index: int) -> "Locator":
1298513004

1298613005
return mapping.from_impl(self._impl_obj.nth(index=index))
1298713006

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+
1298813038
async def focus(self, *, timeout: float = None) -> NoneType:
1298913039
"""Locator.focus
1299013040

@@ -13196,7 +13246,10 @@ async def inner_text(self, *, timeout: float = None) -> str:
1319613246
async def input_value(self, *, timeout: float = None) -> str:
1319713247
"""Locator.input_value
1319813248

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.
1320013253

1320113254
Parameters
1320213255
----------
@@ -13580,6 +13633,10 @@ async def select_text(
1358013633
This method waits for [actionability](https://playwright.dev/python/docs/actionability) checks, then focuses the element and selects all its text
1358113634
content.
1358213635

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+
1358313640
Parameters
1358413641
----------
1358513642
force : Union[bool, NoneType]
@@ -13611,12 +13668,14 @@ async def set_input_files(
1361113668
) -> NoneType:
1361213669
"""Locator.set_input_files
1361313670

13614-
This method expects `element` to point to an
13615-
[input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
13616-
1361713671
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
1361813672
are resolved relative to the the current working directory. For empty array, clears the selected files.
1361913673

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+
1362013679
Parameters
1362113680
----------
1362213681
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:
1549115550
async def to_be_disabled(self, *, timeout: float = None) -> NoneType:
1549215551
"""LocatorAssertions.to_be_disabled
1549315552

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.
1549515557

1549615558
```py
1549715559
from playwright.async_api import expect

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy