1

Hello i have question for chromedriver. I want my own histories, cookies and all other things from my original chrome browser. if this is not possible how to use original chrome browser instead of driver?

2 Answers 2

1

you can use chrome profile (see below image to figure out which profile you want to launch)

  1. Default Profile :

Code :

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=C:\\Users\\***\\AppData\\Local\\Google\\Chrome\\User Data")
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe', options=options)
driver.get("https://www.google.co.in")
  1. for customized profiles :

Code :

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=C:\\Users\\***\\AppData\\Local\\Google\\Chrome\\User Data")
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe', options=options)
driver.get("https://www.google.co.in")

You can get profile while running chrome://version/ in Google chrome.

enter image description here

Sign up to request clarification or add additional context in comments.

4 Comments

Hello im triyng the both of codes but nothing works. I don't see my history, and saved passwords from settings.
@dasdasddasdsadasd : Did you check which profile you would want to launch the browser ? is it default or is there any customized profile ?
@cruisepandey yes, im using default: C:\Users\asshole\AppData\Local\Google\Chrome\User Data\Default
not working at all
0

You can import your default Chrome browser profile to be used by Selenium ChromeDriver as following:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=C:\\Users\\yourUserFolderName\\AppData\\Local\\Google\\Chrome\\User Data\\Default")
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe', chrome_options=options)

3 Comments

Hello im trying your code but i have a problem. nothing saves to driver and i can't login my gmail account because it says this browser is not secury.
This will not help you login gmail. It detects browser managed by automatic toll (selenium) and blocks it.
I fixed problem with using this path: C:\Users\asshole\AppData\Local\Google\Chrome\User Data\Default

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.