Skip to content

Instantly share code, notes, and snippets.

@aib
Created September 21, 2022 18:56
Show Gist options
  • Save aib/331a44e1cbc18634b7107e978e2deb36 to your computer and use it in GitHub Desktop.
Save aib/331a44e1cbc18634b7107e978e2deb36 to your computer and use it in GitHub Desktop.
Persistent profile in selenium
import selenium
import selenium.webdriver
options = selenium.webdriver.chrome.options.Options()
options.binary_location = '/home/aib/tmp/chrome-linux/chrome'
options.add_argument('--user-data-dir=/tmp/selenium_data_dir')
options.add_argument('--profile-directory=SeleniumProfile')
service = selenium.webdriver.chrome.service.Service(executable_path='/home/aib/tmp/chromedriver_linux64/chromedriver')
driver = selenium.webdriver.Chrome(options=options, service=service)
driver.get("http://www.whatarecookies.com/cookietest.asp")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment