You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
723 B
22 lines
723 B
from const import CWD
|
|
from seleniumrequests import Firefox
|
|
from selenium.webdriver.firefox.options import Options
|
|
|
|
|
|
def new_browser(headless=True):
|
|
options = Options()
|
|
options.add_argument("--window-size=1920,1080")
|
|
if headless:
|
|
options.headless = True
|
|
# options.add_argument('--headless')
|
|
try:
|
|
# See if the driver is on path
|
|
browser = Firefox(options=options, executable_path='/usr/local/bin/geckodriver')
|
|
except:
|
|
# Get the dist folder as a backup
|
|
browser = Firefox(options=options, executable_path=CWD + '/drivers/geckodriver-0.33.0/dist/geckodriver.exe')
|
|
|
|
else:
|
|
browser = Firefox(options=options)
|
|
return browser
|