- Get link
- X
- Other Apps
PhantomJS is headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG. Within Python itself, there is module called Selenium. Selenium provide a way to comunicate with PhantomJS that originally build to serve JavaScript. PhantomJS is popular for it headless browser with javascript support. That why in this post, I'll show you how to headlessly browse the internet with PhantomJS and Selenium. Install Selenium Before installing, ensure your python is 3.4 or above to meet selenium requirement. Now, install it with pip pip install selenium Install PhantomJS On Mac you can install it with : brew install phantomjs On Windows or Linux, get PhantomJS from their site Testing Selenium PhantomJS from selenium import webdriver driver = webdriver.PhantomJS() driver.get('https://python.org') html = driver.page_source print(html) Importing selenium module, with : from se...