PhantomJS - WebKit 的服务器端 API


BSD
跨平台
C/C++

软件简介

Phantom JS是一个服务器端的 JavaScript API 的 WebKit。其支持各种Web标准: DOM 处理, CSS 选择器, JSON,
Canvas, 和 SVG

使用场景:

  • 无需浏览器的 Web 测试

  • 页面访问自动化

  • 屏幕捕获

  • 网络监控

屏幕捕获示例代码:

var page = require('webpage').create();
page.open('http://github.com/', function() {
  page.render('github.png');
  phantom.exit();
});

PhantomJS 生态环境:

  • CasperJS enables easy navigation scripting and common high-level testing.

  • Poltergeist allows running Capybara tests headlessly.

  • Guard::Jasmine automatically tests Jasmine specs on Rails when files are modified.

  • GhostDriver complements Selenium tests with a PhantomJS WebDriver implementation.

  • PhantomRobot runs Robot Framework acceptance tests in the background via PhantomJS.

  • Mocha-PhantomJS run Mocha tests using PhantomJS.

其他一些相关项目