-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_driver.py
27 lines (22 loc) · 932 Bytes
/
get_driver.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
from selenium import webdriver
from selenium import common
# driver for raspberry pi
class GetDriver:
def getDriver(headless):
driver = None
# For now always use headless, since no issues with twitter part
options = webdriver.ChromeOptions()
options.add_argument("--no-sandbox")
options.add_argument("--headless")
options.add_argument("--disable-dev-shm-usage")
driver = webdriver.Chrome(
"/usr/lib/chromium-browser/chromedriver", chrome_options=options
)
driver.implicitly_wait(10) # seconds
# if headless:
# options = webdriver.ChromeOptions();
# options.add_argument('--headless')
# driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver', chrome_options=options)
# else:
# driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver')
return driver