Skip to content

Instantly share code, notes, and snippets.

@Sofrosyn
Last active April 1, 2023 21:01
Show Gist options
  • Select an option

  • Save Sofrosyn/1627d68364fdc75232c8c2734f719185 to your computer and use it in GitHub Desktop.

Select an option

Save Sofrosyn/1627d68364fdc75232c8c2734f719185 to your computer and use it in GitHub Desktop.
WebDriver Configuration
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
@Sofrosyn
Copy link
Author

Sofrosyn commented Apr 1, 2023

Setup Steps:

  1. Check your chrome browser version Check Chrome Browser version
  2. Download the chrome drive from this site Chrome Web Driver link
  3. Install selenium using pip pip install -U selenium

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment