#!/usr/bin/python
# This Python file uses the following encoding: utf-8
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument("--test-type")
options.add_argument("--no-sandbox")
options.add_argument("--disable-setuid-sandbox")
driver = webdriver.Chrome("/var/chromedriver/chromedriver")
driver.get('https://google.com')
print(driver.title)
driver.quit()
from functools import partial
from pathlib import Path
from platform import system
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
ROOT_DIR = Path(__file__).parents[0]
if __name__ == '__main__':
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.binary_location = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
local_system = system()
make_path = partial(Path.joinpath, ROOT_DIR, 'chrome_drivers')
if local_system == 'Linux':
driver_path = make_path('chromedriver_linux64')
elif local_system == 'Darwin':
driver_path = make_path('chromedriver_mac64')
elif local_system == 'Windows':
driver_path = make_path('chromedriver_win32.exe')
else:
raise RuntimeError('Unknown os system')
driver = webdriver.Chrome(executable_path=str(driver_path), options=chrome_options)
driver.get('https://www.google.com/')
print(driver.title)
driver.quit()