News for hackers. Stuff that matters.
Re:Headless mode in Firefox by nkkollaw on Wednesday August 30, 2017 @01:16PM (#15133968)
Can someone do an ELI5 on why headless browsers are useful?

I've use them before to make screenshots of webpages, and I have noticed that many NPM packages come (or came) with PhantomJS as a dependency, but I have no idea why one would need that.

Re:Headless mode in Firefox by cbhl on Wednesday August 30, 2017 @01:19PM (#15134003)
Automated integration/regression tests is a pretty big use case.

You spin up a copy of your server, point the headless browser at it, run some JavaScript to simulate some user interactions, and verify the page contains the right strings / screenshot doesn't deviate too much from a golden image.

I guess the ELI5 way of saying that would be: "Making sure your website still works."

People also headless browsers for content generation inside larger systems. (I saw one team make videos by creating CSS animations, and then capturing screenshots from the headless browser at 30 fps.)

Re:Headless mode in Firefox by nashashmi on Wednesday August 30, 2017 @04:12PM (#15135574)
So an ELI5 of everything you said would be:

Putting the website through user actions in a firefox browser and recording/capturing/documenting the results headlessly. Headless version allows you to go through hundreds of results in the background.

Re:Headless mode in Firefox by cbhl on Wednesday August 30, 2017 @07:41PM (#15137030)
Maybe. I got stuck trying to imagine whether a five-year-old would understand what "headless" means in a software context (as opposed to, "headless dragon" or something).
Re:Headless mode in Firefox by nkkollaw on Wednesday August 30, 2017 @02:35PM (#15134722)
Got it.

Thanks!

Re:Headless mode in Firefox by tyingq on Wednesday August 30, 2017 @03:26PM (#15135130)
Scraping for data is another big use case. Like a price comparison web site. Or the company LinkedIn is unhappy about because they are scraping profile data.
Re:Headless mode in Firefox by dboreham on Wednesday August 30, 2017 @01:48PM (#15134299)
To add to the sibling posts:

Crawling the Web. Although you might think that you can crawl a web site by poking through the HTML looking for <a> tags and opening the URLs they contain; that stopped working well a long time ago. Modern sites are essentially complex GUI applications that run inside...a browser. You need either a browser, or some browser-equivalent thing therefore in order to run them and properly crawl them.

Re:Headless mode in Firefox by camoby on Wednesday August 30, 2017 @02:49PM (#15134831)
Isn’t this why these ‘headless’ solution have (or are actually built on) JavaScrict engines like V8 with the ability to also simulate any user interaction?
Re:Headless mode in Firefox by paps on Wednesday August 30, 2017 @01:21PM (#15134020)
Where I work (https://phantombuster.com) we use them for scraping the web.

They're a hassle-free way of getting the data. No need to worry about CORS, sessions, cookies, CSRF and other modern web stuff. Just simulate a human and you’re in.

Re:Headless mode in Firefox by AndyNemmity on Friday September 01, 2017 @04:51AM (#15147052)
Yeah, I used to work for a company doing similar things. Was more expensive that way, but there were tons of sites you could only get the data being in a proper browser.
Re:Headless mode in Firefox by jeeyoungk on Wednesday August 30, 2017 @02:44PM (#15134785)
phantomjs is a lot of work to maintain, and the developer officially deprecated it, recommending people to use chrome headless mode instead.