- PhantomJS Tutorial
- PhantomJS - Home
- PhantomJS - Overview
- PhantomJS - Environment Setup
- PhantomJS - Object
- PhantomJS - Methods
- WebPage Module
- PhantomJS - Properties
- PhantomJS - Methods
- PhantomJS - Events/Callbacks
- PhantomJS - Child Process Module
- File System Module
- PhantomJS - Properties
- PhantomJS - Methods
- System Module
- PhantomJS - Properties
- Web Server Module
- PhantomJS - Properties
- PhantomJS - Methods
- Miscellaneous
- Command Line Interface
- PhantomJS - Screen Capture
- PhantomJS - Page Automation
- PhantomJS - Network Monitoring
- PhantomJS - Testing
- PhantomJS - REPL
- PhantomJS - Examples
- PhantomJS Useful Resources
- PhantomJS - Quick Guide
- PhantomJS - Useful Resources
- PhantomJS - Discussion
PhantomJS - libraryPath Property
This property has the path, which is used by the page.inectJs method.
Syntax
Its syntax is as follows −
var wpage = require('webpage').create(); wpage.libraryPath = 'filepath';
Example
Take a look at the following example −
var webPage = require('webpage'); var page = webPage.create(); page.open('http://www.tutorialspoint.com/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; };
The above program generates the following output.
Jquery Tutorial
phantomjs_webpage_module_properties.htm
Advertisements