CasperJS 如何在 Headless Chrome 發表之後活下去?

工作上有需要 Headless Browser 的人,應該會關注到 Google 釋出的 Headless Chrome,我大概就是那個用了幾年的 CasperJS (背後是 PhantomJS)後,深怕以後無法繼續支援的人之一。因此找到了相關討論: https://github.com/casperjs/casperjs/issues/1825

原來早就有人在討論這個話題,先不管有沒有支援,一堆人討論到 Headless Browser 的神奇用途,例如 jefleponot 就提到:

My job is supervising web services and web appliances for firms and gouvernements. PhantomJS and SlimerJS are really efficient for this work.

You can control :
- networks streams (ressources requests and responses) ... usefull for computer operators and understand navigation troubles
- complex pages with frames / iframes / popup events ... usefull with old systems
- synthetic and nonsynthetic events ... usefull to test responsive pages
- produce rich screenshots with cursor / alert messages / information toolbar by creating dynamic other pages and documents (setContent method)
- you can even, with a linux configuration, test servers' farm network in changing IP address for each browser execution ... mandatory on distributed architecture
- javascript webpage errors occurences (onError /onConsoleMessage...) and asynchronous exchanges (onCallback...)
- scrap data and reinject into another website or export them into files
...

再怎麼說,還可以慶幸當初選擇是個中間層的 Abstract Automatic Testing library,而非直接寫 PhantomJS ... 不然像現在已宣告不再出新版的 PhantomJS ,就哭哭了

Category: