Skip to content

WaitElementVanish.cs

Avrigeanu Laurian edited this page Apr 11, 2023 · 1 revision

WaitElementVanish(string selector, int retries, bool lockToLastPage = false) Method

Waits for the first element in the current page that matches the specified selector to vanish, and returns null.

Parameters

  • selector : A selector that identifies the element to be found.
  • retries : An integer indicating the number of times to retry the wait if the element is still present. Each retry waits for one second before trying again.
  • lockToLastPage : An optional boolean parameter indicating whether to search only the last page in the _context.Pages collection. Default value is false.

Returns

  • null

Exceptions

  • PlaywrightException: If the Playwright library is unable to find the element.

Remarks

This method calls the FindElement() method with the specified selector and lockToLastPage parameter, and waits for the element to vanish. It retries the wait the specified number of times, waiting for one second between retries. If the element vanishes, it logs an information message with the selector, and returns null. If the element does not vanish after the specified number of retries, it logs an information message with the selector, and returns the last IElementHandle found by the FindElement() method. If the element is not found, a PlaywrightException is thrown.

Clone this wiki locally