This is fantastic. I'm using a combination of Chrome and PhantomJS for karma testing right now, for https://github.com/paypal/paypal-checkout and https://github.com/krakenjs/xcomponent . There are hundreds of tests opening up hundreds of iframes and popup windows, and sending a lot of cross-window messages, and that ends up being really memory hungry. Chrome deals pretty well with garbage collection, so long as I'm c…
We also did a POC with PhantomJS and found similar issues, as well as generally flakiness causing too many false negatives. Ended up not using it; I'm hoping this can simplify things are give something more solid to build on.
Chrome 59 has cross-platform headless support
71–80 of 161 posts
Re: Chrome 59 has cross-platform headless support
#72Also checkout https://github.com/cyrus-and/chrome-remote-interface for an easy way to fully control those headless instances
If you're using Go, https://github.com/knq/chromedp It's also worth noting that the 57+ series has a nice embedded viewer you can use to view the actual viewport via devtools.
It dynamically generates Typescript definitions for intelligence and type checking from their protocol.json files.
Vscode chrome debugger uses a fork of it.
I'm the author. /shamelessplug
Re: Chrome 59 has cross-platform headless support
#73Please let this be capable of generating PDFs from HTML from the command line.
Is there an easy way to do the opposite? e.g. read PDFs as HTML (intended to be read through a remote shell), or text?
On the opposite side of the complexity level, I have also used this http://www.pdfsharp.com/PDFsharp/ to extract bits of text from PDFs. It's free, but you only get access to the raw PDF text with formatting codes. It works fine if you just want to grab a short string, but you got your work cut out for you if you want to do anything more sophisticated.
Re: Chrome 59 has cross-platform headless support
#74A lot of phantom js talk here makes me want to recommend http://ghostinspector.com It's a phantom js (and other headless browser) web service. Using the site, you can quickly create different tests, scheduled tests, chained tests, keep screen shots, create videos of multi step tests, and have historical information of it all. Can't say enough good things about the site. Edit: also there's a great chrome extension tha…
They were just starting, but service was rather reliable, and their tech support was excellent (maybe because we were early customers). We used to run a bunch of automated tests for monitoring and compliance, archiving hourly screenshots over different builds for later comparison.
Re: Chrome 59 has cross-platform headless support
#75Earlier quoted context omitted.
Yes: https://chromedevtools.github.io/debugger-protocol-viewer/to...
https://wkhtmltopdf.org/ You can download the two tools wkhtmltopdf and wkhtmltoimage which use WebKit to generate pdfs/images.
Re: Chrome 59 has cross-platform headless support
#76I've been testing Chrome headless extensively for the past few months, and while it's a good step, but it's not stable for high-volume or even diverse set of webpages. Memory usage is pretty high, lot of heavy webpages result in crashes/hangs, there are many inconsistencies between features available in full version and headless, their debugging protocol has different APIs that work on headless/non-headless in Linux…
I ended up writing a simple check using Go's net/http library to do basic performance profiling but it doesn't measure DOM loading like the Chrome checks do. Such a bummer
What I really want is an easy, cross-platform way to collect the network timings for each object like you get in Chrome's dev tools network waterfall graphs.
Re: Chrome 59 has cross-platform headless support
#77Earlier quoted context omitted.
FWIW, you can do that now, using phantomjs (which is chrome) http://phantomjs.org/screen-capture.html
specifically it's qtwebkit and an old version of it.
Re: Chrome 59 has cross-platform headless support
#78Also checkout https://github.com/cyrus-and/chrome-remote-interface for an easy way to fully control those headless instances
If you're using Go, https://github.com/knq/chromedp It's also worth noting that the 57+ series has a nice embedded viewer you can use to view the actual viewport via devtools.
Do you know if chromedp can access any of the timing measurements?
Re: Chrome 59 has cross-platform headless support
#79Earlier quoted context omitted.
same for me. Wonder if we're doing something wrong?
Has it actually landed in the builds yet, or just been marked as targeting 59 in the platform docs?
Re: Chrome 59 has cross-platform headless support
#80This is fantastic. I'm using a combination of Chrome and PhantomJS for karma testing right now, for https://github.com/paypal/paypal-checkout and https://github.com/krakenjs/xcomponent . There are hundreds of tests opening up hundreds of iframes and popup windows, and sending a lot of cross-window messages, and that ends up being really memory hungry. Chrome deals pretty well with garbage collection, so long as I'm c…
What do you do to ensure the resources for closed windows are released?
- Making sure all promises are fulfilled or rejected, so window objects don't get caught indefinitely in closure scope for any .then() or .catch() handler functions.
- Using WeakMaps as much as possible, when we have things that are tied to a particular window, like message listeners or response handlers in post-robot
- Manually clearing up any global references to windows when we destroy an xcomponent instance
Finding the references was the tricky bit. A lot of the effort was finding a leaky test-case, running in 100 times in succession, and deleting code until the memory graph was flat -- then figuring out what I'd just deleted that caused the leak.
The problem started manifesting as I added more and more tests -- so now I'm actually checking my tests' memory usage on the fly and failing if they cross a threshold. Hopefully that should avoid getting into this kind of sticky situation ever again.
https://github.com/paypal/paypal-checkout/blob/master/test/t...