Installation and use of PHANTOMJS

Source: Internet
Author: User

PHANTOMJS is a non-interface, scriptable WebKit browser engine that natively supports a variety of Web standards: DOM manipulation, CSS selectors, JSON, canvas, and SVG.
Selenium supports PHANTOMJS, so it won't pop up a browser when it's running. Moreover, the operation efficiency of PHANTOMJS is also very high, it also supports various parameter configurations and is very convenient to use.

First, install the PHANTOMJS
Official website: http://phantomjs.org
Official Document: Http://phantomjs.org/quick-start.html
: http://phantomjs.org/download.html
API Interface Description: http://phantomjs.org/api/command-line.html


When the download is complete, configure the path where the PHANTOMJS executable is located in the environment variable.
For use in selenium, we just need to switch chrome to PHANTOMJS:

From selenium import Webdriverbrowser = Webdriver. PHANTOMJS () browser.get (' https://www.baidu.com ') print (Browser.current_url)

After running, we will not find a browser pop-up, but actually PHANTOMJS is already running. Here we visit Baidu, and then print out the current URL.
The output of the console is as follows:

https://www.baidu.com/

Installation and use of PHANTOMJS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.