driver.phantomjs Module

class wpull.driver.phantomjs.PhantomJSDriver(exe_path='phantomjs', extra_args=None, params=None)[source]

Bases: wpull.driver.process.Process

PhantomJS processing.

Parameters:
  • exe_path (str) – Path of the PhantomJS executable.
  • extra_args (list) – Additional arguments for PhantomJS. Most likely, you’ll want to pass proxy settings for capturing traffic.
  • params (PhantomJSDriverParams) – Parameters for controlling the processing pipeline.

This class launches PhantomJS that scrolls and saves snapshots. It can only be used once per URL.

close()[source]
start(use_atexit=True)[source]
wpull.driver.phantomjs.PhantomJSDriverParams

PhantomJS Driver parameters

wpull.driver.phantomjs.url

str

URL of page to fetch.

wpull.driver.phantomjs.snapshot_type

list

List of filenames. Accepted extensions are html, pdf, png, gif.

wpull.driver.phantomjs.wait_time

float

Time between page scrolls.

wpull.driver.phantomjs.num_scrolls

int

Maximum number of scrolls.

wpull.driver.phantomjs.smart_scroll

bool

Whether to stop scrolling if number of requests & responses do not change.

wpull.driver.phantomjs.snapshot

bool

Whether to take snapshot files.

wpull.driver.phantomjs.viewport_size

tuple

Width and height of the page viewport.

wpull.driver.phantomjs.paper_size

tuple

Width and height of the paper size.

wpull.driver.phantomjs.event_log_filename

str

Path to save page events.

wpull.driver.phantomjs.action_log_filename

str

Path to save page action manipulation events.

wpull.driver.phantomjs.custom_headers

dict

Custom HTTP request headers.

wpull.driver.phantomjs.page_settings

dict

Page settings.

alias of PhantomJSDriverParamsType

wpull.driver.phantomjs.get_version(exe_path='phantomjs')[source]

Get the version string of PhantomJS.