Last active
April 1, 2023 21:01
-
-
Save Sofrosyn/1627d68364fdc75232c8c2734f719185 to your computer and use it in GitHub Desktop.
WebDriver Configuration
This file contains hidden or 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
| from selenium import webdriver | |
| from selenium.webdriver.chrome.service import Service | |
| import time as time | |
| import selenium.webdriver.common.keys as keys | |
| import selenium.webdriver.common.by as By | |
| from selenium.webdriver.support.ui import Select | |
| chromeService = Service("/Users/newowner/Documents/Learning/Tutorials/Python-Crash-Course/selenium/chromedriver.exe") | |
| def configureWebDriver(): | |
| options = webdriver.ChromeOptions() | |
| options.add_argument("disable-infobars") ## This flag dialog/ information Dialog | |
| options.add_argument('start-maximized') ## Start the brower in full desktop mode | |
| options.add_argument('disable-dev-shm-usage') ## For linux based machines | |
| options.add_argument('no-sandbox') ## disable sanbox | |
| options.add_experimental_option('excludeSwitches', ['enable-automation']) ## Removes automation warning from chrome | |
| options.add_argument('disable-blink-features=AutomationControlled') | |
| driver = webdriver.Chrome(options=options,service=chromeService) | |
| driver.get('https://www.bricklink.com/v2/main.page') ## Url is the base Url of the site you want to scrape | |
| return driver |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setup Steps:
pip install -U selenium