- 文件系统模块
- PhantomJS - 属性
- PhantomJS - 方法
- 系统模块
- PhantomJS - 属性
- Web 服务器模块
- PhantomJS - 属性
- PhantomJS - 方法
- 其他
- 命令行界面
- PhantomJS - 屏幕截图
- PhantomJS - 页面自动化
- PhantomJS - 网络监视
- PhantomJS - 测试
- PhantomJS - REPL
- PhantomJS - 示例
- PhantomJS 有用资源
- PhantomJS - 快速指南
- PhantomJS - 有用资源
- PhantomJS - 讨论
PhantomJS - libraryPath 属性
此属性包含路径,由 page.inectJs 方法使用。
语法
语法如下 −
var wpage = require('webpage').create();
wpage.libraryPath = 'filepath';
示例
看看下面的示例 −
var webPage = require('webpage');
var page = webPage.create();
page.open('https://tutorialspoint.com/jquery', function(status) {
if (status === "success") {
page.includeJs('https://ajax.googleapis.ac.cn/ajax/libs/jquery/1.7.2/jquery.min.js ', function() {
if (page.injectJs('do.js')) {
var title = page.evaluate(function() {
// returnTitle is a function loaded from our do.js file - see below
return returnTitle();
});
console.log(title);
phantom.exit();
}
});
}
});
window.returnTitle = function() {
return document.title;
};
上述程序生成以下输出。
Jquery Tutorial
phantomjs_webpage_module_properties.htm
广告