Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #coding=utf-8
- import time
- from selenium import webdriver
- from selenium.webdriver.chrome.options import Options
- user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36'
- options = webdriver.ChromeOptions()
- #options.headless = True
- options.add_argument("--headless")
- options.add_argument('no-sandbox')
- options.add_argument('user-agent={user_agent}')
- driver = webdriver.Chrome(executable_path='C:/Users/xxxxx/AppData/Local/Python/chromedriver_win32/chromedriver.exe', chrome_options=options, service_args=['--verbose'])
- URL = 'http://example.com/graph.html'
- driver.get(URL)
- S = lambda X: driver.execute_script('return document.body.parentNode.scroll'+X)
- driver.set_window_size(S('Width'),S('Height')) # May need manual adjustment
- driver.find_element_by_id('tttt').screenshot('1.png')
- driver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement