8 ms·
Puppeteer Support for Firefox
- mstijak 2y agoAre there any advantages to using Firefox over Chrome for exporting PDFs with Puppeteer?
- lol768 2y agoI've found Firefox to produce better PDFs than Chrome does, for what it's worth. There are some CSS properties that Chrome/Skia doesn't honour properly (e.g. repeating-linear-gradient) or ends up generating PDFs from that don't work universally.
- freedomben 2y agoIndeed, Firefox uses PDF.js which I've found to produce really good results.
- mook 2y agoDoesn't PDF.js go the other way (convert a PDF into HTML-and-friends for display in a browser, instead of "printing" a page into a PDF)? I haven't dug into it and am quite possibly incorrect, hence the request for confirmation!
- freedomben 2y agoAh damnit, yes you're correct. Too late to edit my comment though.
- ak217 2y agoThat is correct, pdfjs is not usable for printing. Chrome uses Skia for printing, not sure what Firefox uses.
- hugs 2y agoRanked #4 on HN at the moment and no comments. So I'll just say hi. (Selenium project creator here. I had nothing to do with this announcement, but feel free to ask me anything!) My hot take on things: When the Puppeteer team left Google to join Microsoft and continue the project as Playwright, that left Google high and dry. I don't think Google truly realized how complementary a browser automation tool is to an AI-agent strategy. Similar to how they also fumbled the bag on transformer technology. (The T in GPT)... So Google had a choice, abandon Puppeteer and be dependent on MS/Playwright... or find a path forward for Puppeteer. WebDriver BiDi takes all the chocolatey goodness of the Chrome DevTools Protocol (CDP) that Puppeteer (and Playwright) are built on... and moves that forward in a standard way (building on the earlier success of the W3C WebDriver process that browser vendors and members of the Selenium project started years ago.) Great to see there's still a market for cross-industry standards and collaboration with this announcement from Mozilla today.
- localfirst 2y agois it possible to now use Puppeteer from inside the browser? or do security concerns restrict this? what does Webdriver Bidi do and what do you mean by "taking the good stuff from CDP" I don't want to run my scrapes in the cloud and pay a monthly fee I want to run them locally. I want to run LLM locally too. I'm sick of SaaS
- hugs 2y agoPuppeteer controls a browser... from the outside... like a puppeteer controls a puppet. Other tools like Cypress (and ironically the very first version of Selenium 20 years ago) drive the browser from the inside using JavaScript. But we abandoned that "inside out" approach in later versions of Selenium because of the limitations imposed by the browser JS security sandbox. Cypress is still trying to make it work and I wish them luck. You could probably figure out how to connect Llama to Puppeteer. (If no one has done it, yet, that would be an awesome project.)
- localfirst 2y agoI see im still looking for a way to control browser from the inside via an extension browser. very tough problem to solve.
- fitsumbelay 2y agoBeen waiting for this. This rocks
- fhdsgbbcaA 2y agoThe entire Puppeteer team is now in charge of Playwright - and PW already supports Firefox out of the box. This project is about 5 years too late to have a purpose. I am flummoxed why anybody would do this in 2024?
- whatnotests2 2y agoFor an alternative approach, try browserbase.com * https://browserbase.com/ https://browserbase.com/
- cebert 2y agoPlaywright is such a good experience. I don’t understand why you would need something like browserbase.
- nsonha 2y agohave you actually done any web scrapping at scale? The problem is never the web automation. It's bypassing IP blacklist, rate limits, capcha etc, and a hosted service can provide solutions for those: > Proxies included..., Auto Captcha Solving, Advanced Stealth Mode Other than that, like everything else, a hosted service is always an option and not contradict with you being able to host that service directly, they're just for different sets of constrains.
- bdcravens 2y agoI have, and solved a lot of those problems. Yes, it requires additional plugins and services, but I prefer to own the solution (a must-have for my use case, but for someone where it's lower stakes perhaps a hosted solution is ideal to the engineering/research)
- e12e 2y agoWhat are reasons to prefer puppeteer to playwright which supports many browsers? > Cross-browser. Playwright supports all modern rendering engines including Chromium, WebKit, and Firefox. https://playwright.dev/ https://playwright.dev/
- Vinnl 2y agoI said this in a subthread: > I think Playwright depends on forking the browsers to support the features they need, so that may be less stable than using a standard explicitly supported by the browsers, and/or more representative of realistic browser use. (And for Safari/WebKit to support it as well, but I'm not holding my breath for that one.) Though I hope Playwright will adopt BiDi at some point as well, as its testing features and API are really nice.
- creesch 2y agoGood question, even more so considering they were made by the same people. After the creators of puppeteers moved to Microsoft and started work on Playwright, I got the impression that puppeteer was pretty much abandoned. Certainly in the automation circles I find myself in I barely see anyone using or talking puppeteer unless it is a bit of legacy project.
- irjustin 2y agoI also wonder the same. Playwright is so good. I simply don't have flaky tests even when dealing with features that are playwrights' fault. I used to have so many issues with Selenium and so only used it in must have situations defaulting to capybara to run out specs.
- dataviz1000 2y agoIf you open up the code Playwright codebase you will discover that it is literally Puppeteer with the copyright message header in the base files belonging to Google. It is a fork.
- creesch 2y ago
- yoavm 2y agoI know this isn't what the WebDriver BiDi protocol is for, but I feel like it's 90% there to being a protocol through which you can create browsers, with swappable engines. Gecko has gone a long way since Servo, and it's actually quite performant these days. The sad thing is that it's so much easier to create a Chromium-based browser than it is to create a Gecko based one. But with APIs for navigating, intercepting requests, reading the console, executing JS - why not just embed the thing, remove all the browser chrome around it, and let us create customized browsers?
- djbusby 2y agoI have dreamed about a swappable engine. Like, a wrapper that does my history and tabs and book marks - but let's me move from rendering in Chrome or Gecko or Servo or whatever.
- sorenjan 2y agoThere used to be an extension for Firefox called "IE Tab for Firefox" that used the IE rendering engine inside a Firefox tab, for sites that only worked in IE.
- hyzyla 2y agoThe same idea with built in Internet Explorer in Microsoft Edge, where you can switch to Internet Explorer mode and open website that only correctly works in Internet Exlorer
- pauldino 2y agoAnd Google made basically the opposite thing to embed Chrome within Internet Explorer for sites that wouldn't work in IE. https://en.wikipedia.org/wiki/Google_Chrome_Frame https://en.wikipedia.org/wiki/Google_Chrome_Frame
- joshuaissac 2y agoThere are some browsers that support multiple rendering engines out of the box, like Maxthon (Blink + Trident) and Lunascape (Blink + Gecko + Trident).
- burntcaramel 2y agoThis is great! I’m curious about the accessibility tree noted in the unsupported-for-now APIs. Accessing the accessibility tree was something that was in Playwright for the big 3 engines but got removed about a year ago. I think it was partly because as noted it was a dump of engine-specific internal data structures: “page.accessibility.snapshot returns a dump of the Chromium accessibility tree”. I’d like to advocate for more focus on these accessibility trees. They are a distillation of every semantic element on the page, which makes them fantastic for snapshot “tests” or BDD tests. My dream would be these accessibility trees one day become standardized across the major browser engines. And perhaps from a web dev point-of-view accessible from the other layers like CSS and DOM.
- jesprenj 2y agoWhat I very dislike about current browser automation tools is that they all use TCP for connecting the browser with the manager program. This means that, unlike for UNIX domain sockets, filesystem permissions (user/group restrictions) cannot be used to protect the TCP socket, which opens the browser automation ecosystem to many attacks where 127.0.0.1 cannot be trusted (untrusted users on a shared host). I have yet to see a browser automation tool that does not use localhost bound TCP sockets. Apart from that, most tools do not offer strong authentication -- a browser is spawned and it listens on a socket and when the controlling application connects to the browser management socket, no authentication is required by default, which creates hidden vulnerabilites. While browser sessions may only be controlled by knowing their random UUIDs, creating new sessions is usually possible to anyone on 127.0.0.1. I don't know really, it's quite possible I'm just spreading lies here, please correct me and expand on this topic a bit.
- JoelEinbinder 2y agoYou can set `pipe` to true in puppeteer (default false) here https://pptr.dev/api/puppeteer.launchoptions https://pptr.dev/api/puppeteer.launchoptions By default, Playwright launches this way and you have to specifically enable the tcp listening.
- jesprenj 2y agoGreat, I stand corrected! I still don't know how they convince firefox/chromium to use a pipe as a websocket transport layer.
- _heimdall 2y agoI have always wanted a browser automation tool that taps directly into the accessibility tree. Plenty do supporting querying based on accessibility features, but unless I'm mistaken none go directly to the same underlying accessibility tree used by screen readers and similar. Happy to be wrong here if anyone can correct me. The idea of all tests confirming both functionality and accessibility in one go would be much nicer than testing against hard coded test IDs and separately writing a few a11y tests if I'm offered the time.
- glub103011 2y ago[dead]
- ed_mercer 2y agoShouldn’t the title be “Firefox support for puppeteer”?
- jgraham 2y agoWell the truth is it's both. We had to change Firefox so it could be automated with WebDriver BiDi. The Puppeteer team had to change Puppeteer in order to implement a WebDriver BiDi backend, and to enable specific support for downloading and launching Firefox. As the article says, it was very much a collaborative effort. But the announcement is specifically about the new release of Puppeteer, which is the first to feature non-experimental support for Firefox. So that's why the title's that way around.
- dwoldrich 2y agoCheers, I hope this boosts Firefox's marketshare!
- throwaway81523 2y agoIs this important? I use Selenium, and have a vague impression that Puppeteer is considered somewhat better, but I have no idea if the difference is enough to really care about. I only use Firefox and don't care about Chrome.