This thread is trying to answer question "How can I add screenshot taking when running playwright so that I can see the exact error in the browser?"
See https://playwright.dev/docs/api/class-testoptions#test-options-screenshot 😉
use: { screenshot: "only-on-failure" }
And an even better alternative (to screenshots): Enable trace files and use the trace viewer to troubleshoot your test issues.
Set your traces to 'retain-on-failure'
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].