-
Notifications
You must be signed in to change notification settings - Fork 0
WaitElementVisible.cs
Avrigeanu Laurian edited this page Apr 11, 2023
·
1 revision
Waits for the first element in the current page that matches the specified selector to become visible, and returns it.
-
selector
: A selector that identifies the element to be found. -
lockToLastPage
: An optional boolean parameter indicating whether to search only the last page in the_context.Pages
collection. Default value isfalse
. -
retries
: An optional integer parameter indicating the number of times to retry the search in case of a failure. Default value is15
.
- An
IElementHandle
representing the first visible element that matches the specified selector.
-
PlaywrightException
: If the Playwright library is unable to find the element.
This method first calls the FindElement()
method with the specified selector and lockToLastPage
parameter, and waits for the element to appear. If the element is not found, it retries the search the specified number of times, waiting for the element to appear each time. Once the element is found, it waits for it to become visible. If the element is visible, it logs an information message with the selector, and returns the element. If the element is not visible after the specified number of retries, a PlaywrightException
is thrown. If the element is not found, a PlaywrightException
is thrown.