Advertisement
serikov

Selenium use existing profile problem

Oct 2nd, 2024
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | Software | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import time
  4. from selenium import webdriver
  5. from selenium.webdriver.chrome.options import Options
  6. from selenium.webdriver.chrome.service import Service
  7. from webdriver_manager.chrome import ChromeDriverManager
  8.  
  9. driver_path = ChromeDriverManager().install()
  10. service = Service(executable_path=driver_path)
  11.  
  12. chrome_options = Options()
  13.  
  14. chrome_options.add_argument("user-data-dir=/home/a/.config/google-chrome")
  15. chrome_options.add_argument("--profile-directory=Default")
  16. chrome_options.add_argument("--disable-extensions")
  17.  
  18. driver = webdriver.Chrome(service=service, options=chrome_options)
  19.  
  20. driver.get('chrome://version')
  21. print(driver.title)
  22. time.sleep(5)
  23.  
  24. driver.get('https://gmail.com')
  25. print(driver.title)
  26. time.sleep(300)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement