PhantomJSWebKit 的服务器端 API

联合创作 · 2023-09-23 15:35

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.

其他一些相关项目

浏览 6
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报