简体   繁体   中英

CLI to load html in phantomjs or chromium headless and get any javascript errors

I have a self-contained non-interactive html artifact that I would like to check for javascript errors in an automated single CLI call way so it can integrate with my java based functional tests. I just want to send the html file to some headless browser and get any errors like would be in the F12 console. Preferably this does not involve a server.

PhantomJS has page.onError callback just for this purpose. Just conjure up a script that collects errors and have it write errors to a log or send via email, then run the script from cli when needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM