Created
September 21, 2022 18:56
-
-
Save aib/331a44e1cbc18634b7107e978e2deb36 to your computer and use it in GitHub Desktop.
Persistent profile in selenium
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
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