3 ms·
Each of the page operations (e.g. click) automatically wait for the specified element to become visible before being performed. That way, your automation code i
by lostintangent 7y ago
Each of the page operations (e.g. click) automatically wait for the specified element to become visible before being performed. That way, your automation code is declarative about what you want to do, and to what element(s), and you can allow the Playwright framework to handle any “waits” on your behalf (without having to rely on time as a pseudo event).
To make the act of selecting elements more resilient to change, Playwright also supports a collection of “selector engines” that allow you to choose the best strategy for selecting elements (via CSS selector, xpath, text content). Additionally, you can author entirely custom selector engines, and compose them together with the built-in types. This is still somewhat experimental, but we think this can enable another level of robustness to test automation: https://github.com/microsoft/playwright/blob/master/docs/selectors.md#custom-selector-engines https://github.com/microsoft/playwright/blob/master/docs/sel....
Finally, in addition to waiting for element visibility, Playwright allows you to wait for specific page events to occur (e.g. network request work made). This enables your code to leverage deterministic “signals”, not timeouts (which are the source of a lot of flakiness!). Overall, we want it to be possible to author automation that is entirely event-driven, and includes zero arbitrary timeouts.
- mastah88 7y agoWhat about smart selectors? First run uses defined selector but also saves othe attributes. If in next run element can be found by defined selector then those saved parameters are used to locate element.