I wanted to visit some websites via python and take screenshots of the website without opening up the browser. Is this possible?
I was recommended to look into PhantomJS but the tutorials on the site seem to be mainly in Java.
Is there a module I should look into?
Thank you.
from selenium import webdriver
browser = webdriver.PhantomJS('/home/metulburr/phantomjs')
browser.get('https://python-forum.io/Thread-Visiting-websites-and-taking-screenshots-implicitly')
browser.save_screenshot('screenshot.png')
browser.quit()
Where the path i give PhantomJS() is the path to my phantomjs
Wow, this was super easy. Thank you.
If I wanted to have more freedom, say for example, just take screenshots of only the pictures on the website, it seems I'm able to do this?
It seems that's what the PhantomJS site is referring to here:
http://phantomjs.org/screen-capture.html ?
Is there a python-version of this documentation? I'm only finding loose tutorials via Google.
(May-01-2017, 11:41 AM)metulburr Wrote: [ -> ]see this post
https://python-forum.io/Thread-selenium-screenshot
You should be searching for "selenium python" code. PhantomJS is what you would be using, but that doesnt change the code at all on selenium. This I believe is the official documentation.
Your post in the provided link above was very useful.
I was able to pull out just the chart, via the tag_name('svg')
Thank you!