PhantomJS simple example. PhantomJS is a WebKit-oriented browser that provides JavaScript programming interfaces (APIs. It provides quick and native support for web standards: DOM operations, CSS delimiters, JSON, and PhantomJS are WebKit-oriented non-interface browsers that provide JavaScript programming interfaces (APIs. It provides
FastAnd
NativeSupported: DOM operations, CSS delimiters, JSON, Canvas, and SVG.
1. download and unzip PhantomJS http://phantomjs.org/
2. write simple test code and save it as test. js. after decompression, there are a large number of instances in phantomjs \ examples for your reference.
Console. log ('loading a web page' page = require ('webpage' url = 'http: // www.phantomjs.org/'(status! = 'Success' 'Unable to post! '
3. because I am using windows, I enter the CMD command line mode to run test. js and use the pipeline token to output the result to test.txt. if the pipeline is not used, the result is output directly.
.
4. Because PhantomJS supports command line, we can use PHP, Java, or Python to directly obtain the result during development.
APIs. It provides quick and native support for web standards: DOM operations, CSS delimiters, JSON ,...