I looking for ability render pdf with PhantomJS
via GhostDriver
, not just render pdf. When I use next code, then page normally loaded:
from selenium import webdriver
driver = webdriver.PhantomJS('./node_modules/phantomjs/bin/phantomjs')
driver.set_window_size(1024, 768)
driver.get('http://stackoverflow.com')
When I use next script via command line https://github.com/ariya/phantomjs/blob/master/examples/rasterize.js then pdf generated perfectly.
Now I want execute script like rasterize.js
(page.render('file.pdf')
) but via webdriver
. webdriver
has execute_script
method but it look like PhantomJS
code evaluation and do not have access to webpage
instance context. Also webdriver
has get_screenshot_as_base64
method, but it return only png.
I use latest versions of selenium
, phantomjs
, nodejs
.
So my question how I can get access to PhantomJS
webpage instance via GhostDriver
and evaluate render
method?