-
Notifications
You must be signed in to change notification settings - Fork 0
GetFocusedElement.cs
Avrigeanu Laurian edited this page Apr 11, 2023
·
1 revision
Returns the currently focused element in the current page.
-
lockToLastPage
: An optional boolean parameter indicating whether to search only the last page in the_context.Pages
collection. Default value istrue
.
- An
IElementHandle
representing the currently focused element in the current page.
-
PlaywrightException
: If the Playwright library is unable to find the focused element.
This method first calls the FindElement()
method with the CSS selector "*:focus"
, which finds the first focused element in the current page. If lockToLastPage
is true
, the search is limited to the last page in the _context.Pages
collection. It then logs a warning message with the X and Y coordinates of the focused element's bounding box, and returns the focused element.