question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] Richer convenience API

See original GitHub issue

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.

  • check() - @dgozman had a patch for it already.
  • clock() - a user-land virtual time implementation, limited to setTimeout, setInterval and Date. I don’t think we should get into the weeds of the native virtual time implementation, but we could at least make it work across frames and workers (currently not supported in Cypress), wire performance.now, etc. Would be interesting to get some feedback from the field on how useful it is. Time mock was already mentioned here.
  • pause() - handy for those not using the debugger, we could resume from cli or devtools.
  • request(url) - auth0 recommends it as a part of the login routine in your POM. This could simply be a fetch call wrapper, returning status, headers and body using our interception. Not sure why Cypress does it from within Node context, they could be doing a real fetch.
  • rightclick - we have click, dblclick and even tripleclick. Probably worth exposing isTrusted context menu trigger as well.
  • route - looks like a user-land XHR override. Playwright’s interception is much more powerful, but I like the shape of the route API. I don’t like how Puppeteer/Playwright handle network from the events today, I’d rather use the glob / predicate matcher.
  • submit - looks simple and useful
  • uncheck() - same as check

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
pavelfeldmancommented, Apr 15, 2020

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

0reactions
aesyonducommented, Apr 6, 2020

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").

Read more comments on GitHub >

github_iconTop Results From Across the Web

Features and APIs Overview | Android Developers
Android 13 introduces great new features and APIs for developers. The sections below help you learn about features for your apps and get...
Read more >
Send Interactive Messages on the WhatsApp Business Platform
Create an engaging, richer messaging experience for your customers with interactive messages like list messages and button replies.
Read more >
Outlook personal contacts API overview - Microsoft Graph
Contacts provide a complementary function for messaging and calendaring by letting customers maintain a convenient, integrated store of contacts ...
Read more >
Bookerville's API
Feed Bookerville data into an accounting system or other software. Richer, more sopisticated integration with a website than Bookerville's widgets provide. To ...
Read more >
Data APIs (and the DataStore) - Datopian Tech
Furthermore, much of the richer functionality of a DMS or Data Portal such as data visualization and exploration require API data access rather ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found