- 檔案系統模組
- 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.tw/jquery', function(status) {
if (status === "success") {
page.includeJs('http://ajax.googleapis.com/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
廣告