Created
May 8, 2022 07:52
-
-
Save MShirazAhmad/8f962cca01b4812682609b6678f0c909 to your computer and use it in GitHub Desktop.
SeleniumLibrary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def open_chrome(headLess = False): | |
import csv | |
from parsel import Selector | |
from selenium.webdriver.common.keys import Keys | |
import time | |
import os | |
from selenium import webdriver | |
from webdriver_manager.utils import ChromeType | |
from webdriver_manager.chrome import ChromeDriverManager | |
chrome_options = webdriver.ChromeOptions(); | |
chrome_prefs = {} | |
chrome_prefs["profile.default_content_settings"] = {"images": 2} | |
chrome_prefs["profile.managed_default_content_settings"] = {"images": 2} | |
chrome_options.experimental_options["prefs"] = chrome_prefs | |
chrome_options.add_experimental_option("excludeSwitches", ['enable-automation']); | |
if headLess == True: | |
chrome_options.add_argument("--headless") | |
chrome_options.add_argument('--no-proxy-server') | |
chrome_options.add_argument("--proxy-server='direct://'"); | |
chrome_options.add_argument("--proxy-bypass-list=*"); | |
# chrome_options.add_experimental_option("prefs", prefs) | |
driver = webdriver.Chrome(ChromeDriverManager().install(),options=chrome_options); | |
return driver |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment