Hacker News new | ask | show | jobs
by MauroIksem 1839 days ago
Have you tried selinium and phantomjs headless ? I was using that a few years ago and it worked very well.
4 comments

PhtantomJS was abandoned officially a long time ago because of all these new and better tools.

Selenium is a source of constant bugs and misery - it's truly a waste of time maintaining its usage in a codebase because randomly sometimes tests fail. The C# wrapper for it is even worse, as it does not follow the idioms of C# and is a straight 1:1 port from the Java version. Highlights include getting exceptions from properties when you hover over them during debug in Visual Studio.

it reflects my experience

rerunning tests because always a few of them fail on first run

but I noticed that the biggest reason was that often my browser was a little ahead when it comes to version than engine, and after updating both of them the situation was a kinda better.

Anyway I don't recommend Selenium, it wastes too much time

Selenium is still very flaky. We have almost zero problems with playwright except where we made the mistake. On the other hand, we get all sorts of weird glitches with Selenium and often have to re-run tests for them to pass with no other changes.
I have built selenium test harnesses using webdriverjs and Jest as the runner at my two most recent jobs. Been using the webdriverjs 4 alpha which has/had been in progress forever. I've never had a flakey-ness issue that was the fault of selenium.

I don't understand why it doesn't get more love and support. You can build higher level testing frameworks right on top of it.

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.
Assuming those run a container? With puppeteer on Heroku, I had to install chrome as part of the container, then pass it no-sandbox on startup. I'd guess you'd need something similar with chrome (I'm on mobile, so excuse the formatting):

  #Install Chrome for Puppeteer: 
  RUN curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
  RUN apt-get update -y
  RUN apt-get install -y ./google-chrome-stable_current_amd64.deb
  RUN rm google-chrome-stable_current_amd64.deb 
  ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
  ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome-stable

  browser = await Puppeteer.LaunchAsync(
                        new LaunchOptions {
                            //If we're debugging, then open actual chrome:
                            Headless = !Debugger.IsAttached,
                            Args = new string[] {
                            "--no-sandbox"
                        },
                        });
I can run puppeteer in a Lambda fine, it's just that when you navigate to a webpage with a background loaded as a css image it doesn't wait for that to load before taking the screen grab. :(

https://github.com/puppeteer/puppeteer/issues/4046

Could be the same reason why this doesn't work as an Azure Function either:

https://github.com/microsoft/playwright-dotnet/issues/1076