-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselenium_tool.py
38 lines (31 loc) · 1.26 KB
/
selenium_tool.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from selenium.webdriver.common.by import By
from selenium_stealth import stealth
from webdriver_manager.chrome import ChromeDriverManager
from shutil import which
def create_webdriver():
options = webdriver.ChromeOptions()
options.headless = True
options.add_argument("start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option("useAutomationExtension", False)
# service = ChromeService(ChromeDriverManager(cache_valid_range=10).install())
# browser = webdriver.Chrome(options=options, service=service)
browser = webdriver.Chrome(options=options, executable_path=which("chromedriver"))
stealth(
browser,
languages=["en-US", "en"],
vendor="Google Inc.",
platform="Win32",
webgl_vendor="Intel Inc.",
renderer="Intel Iris OpenGL Engine",
fix_hairline=True,
)
return browser
browser = create_webdriver()
#browser.get("https://www.stakingrewards.com/earn/ethereum-2-0/metrics/")
browser.get("https://data.binance.vision/?prefix=data/spot/monthly/klines")
text = browser.page_source
print(text)
# print browser.find_element()