Live data from Hacker News

Playwright for .NET is now stable

github.com

1–10 of 66 posts

Re: Playwright for .NET is now stable

#2
Oh, I didn't know this existed. Definitely going to try this. I'm currently using Puppeteer Sharp (https://github.com/hardkoded/puppeteer-sharp) and something like:

> await page.GotoAsync("https://playwright.dev/dotnet");

> await page.ScreenshotAsync(new PageScreenshotOptions() { Path = "screenshot.png" });

Is broken, if you have background images in CSS the screenshot happens after Page Load is completed but before all CSS images are loaded so you end up not getting backgrounds in the screenshot. The only solution is to try add a delay before taking the screen grab, and it there's any sort of latency then the delay could result in not getting a good screenshot...

Re: Playwright for .NET is now stable

#4

Oh, I didn't know this existed. Definitely going to try this. I'm currently using Puppeteer Sharp ( https://github.com/hardkoded/puppeteer-sharp ) and something like: > await page.GotoAsync(" https://playwright.dev/dotnet "); > await page.ScreenshotAsync(new PageScreenshotOptions() { Path = "screenshot.png" }); Is broken, if you have background images in CSS the screenshot happens after Page Load is completed but bef…

Have you tried selinium and phantomjs headless ? I was using that a few years ago and it worked very well.

Re: Playwright for .NET is now stable

#5

Oh, I didn't know this existed. Definitely going to try this. I'm currently using Puppeteer Sharp ( https://github.com/hardkoded/puppeteer-sharp ) and something like: > await page.GotoAsync(" https://playwright.dev/dotnet "); > await page.ScreenshotAsync(new PageScreenshotOptions() { Path = "screenshot.png" }); Is broken, if you have background images in CSS the screenshot happens after Page Load is completed but bef…

Have you tried selinium and phantomjs headless ? I was using that a few years ago and it worked very well.

I couldn't get it working in an AWS Lambda. May work now but I haven't had time this year to re-visit that project.

Re: Playwright for .NET is now stable

#6
post #3

really curious about peoples experience with this compared to things like Cypress.

This question does come up quite a lot. One thing the remember is that Cypress is "batteries included" testing framework, where Playwright is essentially just the browser automation part of it.

I know the Playwright team is "moving up the stack" and adding many specific testing features, but it's not at the same level (yet?) as Cypress.

Re: Playwright for .NET is now stable

#9
post #3

really curious about peoples experience with this compared to things like Cypress.

Well, Cypress is going to use playwright for their Webkit integration.

Cypress is more limited compared to Playwright such as multi-domains aren't supported, multiple tabs, or popup windows. For my tests that require that I am using Playwright and for the rest I am currently using Cypress. But I do think the test writing experience is better with Cypress :)

I am considering to move to Playwright for everything now with the new Trace Viewer (https://playwright.dev/docs/debug#playwright-trace-viewer); and contribute to that.

Re: Playwright for .NET is now stable

#10
post #3

really curious about peoples experience with this compared to things like Cypress.

I've had some issues with Cypress selectors randomly failing to find matching elements, even though they are clearly present. Like if I run the same script 10 times it goes through ~7 times. I wanted to try Playwright for another application to avoid such issues.

And then I was very surprised to get almost the exact same issues with Playwright. Running against a different application with different test cases.

Has anyone else had issues like this with React applications? It's very annoying to not be able to write repeatable tests.

Post reply on HN