microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.83k stars 3.67k forks source link

[Feature] Richer convenience API #820

Closed pavelfeldman closed 4 years ago

pavelfeldman commented 4 years ago

I was looking at Cypress API - it does a great job exposing some of the higher-level driver primitives and I was wondering if some of them would make sense to Playwright as well.

Feel free to comment add / remove things you'd like to see (would not like to see) in Playwright.

jperl commented 4 years ago

Idea for pause(): opens a repl so user can try out different commands.

Something like this https://github.com/qawolf/qawolf/blob/master/packages/repl/src/repl.ts

hdorgeval commented 4 years ago

Hi @pavelfeldman, you might be interested in this project: Fluent API around Playwright

jperl commented 4 years ago

This project is holds our utilities (working on adding a lot more). Perhaps some of them might move into playwright core. https://github.com/qawolf/playwright-utils

aesyondu commented 4 years ago

How about elementHandle.text(), as a convenience for elementHandle.evaluate((node) => node.textContent).

Generally, page.$eval(".css-selector", (node) => node.textContent) -> page.text(".css-selector").

pavelfeldman commented 4 years ago

@aesyondu: elementHandle.textContent and elementHandle.innerText are now available. I'll close the meta bug and open new bugs as we go.