@@ -3999,8 +3999,6 @@ def locator(self, selector: str) -> "Locator":
39993999 element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
40004000 different DOM elements. That would happen if the DOM structure between those actions has changed.
40014001
4002- Note that locator always implies visibility, so it will always be locating visible elements.
4003-
40044002 Parameters
40054003 ----------
40064004 selector : str
@@ -7344,8 +7342,6 @@ def locator(self, selector: str) -> "Locator":
73447342 element immediately before performing an action, so a series of actions on the same locator can in fact be performed on
73457343 different DOM elements. That would happen if the DOM structure between those actions has changed.
73467344
7347- Note that locator always implies visibility, so it will always be locating visible elements.
7348-
73497345 Shortcut for main frame's `frame.locator()`.
73507346
73517347 Parameters
@@ -9469,7 +9465,9 @@ def expect_page(
94699465 ).future
94709466 )
94719467
9472- async def new_cdp_session (self , page : "Page" ) -> "CDPSession" :
9468+ async def new_cdp_session (
9469+ self , page : typing .Union ["Page" , "Frame" ]
9470+ ) -> "CDPSession" :
94739471 """BrowserContext.new_cdp_session
94749472
94759473 > NOTE: CDP sessions are only supported on Chromium-based browsers.
@@ -9478,8 +9476,9 @@ async def new_cdp_session(self, page: "Page") -> "CDPSession":
94789476
94799477 Parameters
94809478 ----------
9481- page : Page
9482- Page to create new session for.
9479+ page : Union[Frame, Page]
9480+ Target to create new session for. For backwards-compatability, this parameter is named `page`, but it can be a `Page` or
9481+ `Frame` type.
94839482
94849483 Returns
94859484 -------
@@ -9489,7 +9488,7 @@ async def new_cdp_session(self, page: "Page") -> "CDPSession":
94899488 return mapping .from_impl (
94909489 await self ._async (
94919490 "browser_context.new_cdp_session" ,
9492- self ._impl_obj .new_cdp_session (page = page . _impl_obj ),
9491+ self ._impl_obj .new_cdp_session (page = page ),
94939492 )
94949493 )
94959494
@@ -9615,7 +9614,8 @@ async def new_context(
96159614 record_video_dir : typing .Union [str , pathlib .Path ] = None ,
96169615 record_video_size : ViewportSize = None ,
96179616 storage_state : typing .Union [StorageState , str , pathlib .Path ] = None ,
9618- base_url : str = None
9617+ base_url : str = None ,
9618+ strict_selectors : bool = None
96199619 ) -> "BrowserContext" :
96209620 """Browser.new_context
96219621
@@ -9709,6 +9709,10 @@ async def new_context(
97099709 Examples:
97109710 - baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
97119711 - baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
9712+ strict_selectors : Union[bool, NoneType]
9713+ It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
9714+ that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
9715+ more about the strict mode.
97129716
97139717 Returns
97149718 -------
@@ -9747,6 +9751,7 @@ async def new_context(
97479751 recordVideoSize = record_video_size ,
97489752 storageState = storage_state ,
97499753 baseURL = base_url ,
9754+ strictSelectors = strict_selectors ,
97509755 ),
97519756 )
97529757 )
@@ -9781,7 +9786,8 @@ async def new_page(
97819786 record_video_dir : typing .Union [str , pathlib .Path ] = None ,
97829787 record_video_size : ViewportSize = None ,
97839788 storage_state : typing .Union [StorageState , str , pathlib .Path ] = None ,
9784- base_url : str = None
9789+ base_url : str = None ,
9790+ strict_selectors : bool = None
97859791 ) -> "Page" :
97869792 """Browser.new_page
97879793
@@ -9870,6 +9876,10 @@ async def new_page(
98709876 Examples:
98719877 - baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
98729878 - baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
9879+ strict_selectors : Union[bool, NoneType]
9880+ It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
9881+ that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
9882+ more about the strict mode.
98739883
98749884 Returns
98759885 -------
@@ -9908,6 +9918,7 @@ async def new_page(
99089918 recordVideoSize = record_video_size ,
99099919 storageState = storage_state ,
99109920 baseURL = base_url ,
9921+ strictSelectors = strict_selectors ,
99119922 ),
99129923 )
99139924 )
@@ -10218,7 +10229,8 @@ async def launch_persistent_context(
1021810229 record_har_omit_content : bool = None ,
1021910230 record_video_dir : typing .Union [str , pathlib .Path ] = None ,
1022010231 record_video_size : ViewportSize = None ,
10221- base_url : str = None
10232+ base_url : str = None ,
10233+ strict_selectors : bool = None
1022210234 ) -> "BrowserContext" :
1022310235 """BrowserType.launch_persistent_context
1022410236
@@ -10345,6 +10357,10 @@ async def launch_persistent_context(
1034510357 Examples:
1034610358 - baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
1034710359 - baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
10360+ strict_selectors : Union[bool, NoneType]
10361+ It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
10362+ that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
10363+ more about the strict mode.
1034810364
1034910365 Returns
1035010366 -------
@@ -10397,6 +10413,7 @@ async def launch_persistent_context(
1039710413 recordVideoDir = record_video_dir ,
1039810414 recordVideoSize = record_video_size ,
1039910415 baseURL = base_url ,
10416+ strictSelectors = strict_selectors ,
1040010417 ),
1040110418 )
1040210419 )
@@ -11009,7 +11026,7 @@ async def evaluate(
1100911026 Examples:
1101011027
1101111028 ```py
11012- tweets = await page.locator(\" .tweet .retweets\" )
11029+ tweets = page.locator(\" .tweet .retweets\" )
1101311030 assert await tweets.evaluate(\" node => node.innerText\" ) == \" 10 retweets\"
1101411031 ```
1101511032
0 commit comments