Playwright Auto-waiting

The playwright performs a wide range of checks before making any actions to ensure these behave as expected. It auto waits for all relevant reviews to pass and proceeds to the next step. This is done within the provided timeout and fails if it reaches a timeout error.

There is a playwright check for whether the element is attached, visible, stable, receives events, and enabled for all occasions.

  1. Attached: The elements are considered attached when it is connected to a document.
  2. Editable: It is considered editable when the element is enabled and does not have a read-only property set
  3. Enabled: It is considered enabled when the button, select, input, or textarea does not have a disabled property set
  4. Receive Events: When the element is the hit target of the pointer at the action point, it is considered to be receiving pointer events. 
  5. Stable: Elements are considered stable when it maintains the same bounding box even after two or more consecutive animation frames.
  6. Visible: Elements are considered visible if they do not have visibility: hidden computed style. Elements with zero size or display: none are considered visible.

This event can be imagined with an example of signing up.

When the playwright clicks on sign up.

  • Page checks that the username is unique, and the sign-up button is disabled if it is not unique.
  • After checking, the disabled sign-up is replaced with another one that is now enabled.
  • This is receiving pointer events.

Conclusion:

So these are some of the actionability checks performed by the playwright for auto waiting.

Mon, 05/30/2022 - 14:44

Authored by

Ashwin is working with iVagus as a Technical Lead. He has experience in various technologies like Cypress, JavaScript, TypeScript, Rest Assured, Selenium, Cucumber, and Java.
Tags