-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheadless.py
More file actions
24 lines (18 loc) · 807 Bytes
/
Copy pathheadless.py
File metadata and controls
24 lines (18 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from pathlib import Path
options = webdriver.ChromeOptions()
options.headless = True
PATH = ".\chromedriver.exe"
driver = webdriver.Chrome(PATH, options=options)
driver.get("https://codeforces.com/problemset")
def S(X): return driver.execute_script(
'return document.body.parentNode.scroll'+X)
driver.set_window_size(S('Width'), S('Height'))
driver.find_element_by_tag_name('body').screenshot('demo.png')