1
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import time
import datetime


ch_options = webdriver.ChromeOptions()
ch_options.add_argument("--user-data-dir=C:\\Users\\Dossy\\AppData\\Local\\Google\\Chrome\\User Data")


chrome = webdriver.Chrome(options=ch_options)

chrome.get("https://www.google.com/")

this code only open up the chromedriver with my profile, but couldn't redirect to a link

4 Answers 4

1

Try this with your correct driver path

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import time
import datetime

chromedriver = 'path of chrome driver till chromedriver.exe'
driver = webdriver.Chrome(chromedriver)
driver.get("https://www.google.com/")

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

Comments

1

Making it so simple and short: Make sure to add the chrome driver path correctly

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import time
import datetime

PATH = r"C:\Program Files (x86)\chromedriver.exe"    # Path where u have downloaded the driver

driver = webdriver.Chrome(PATH)

driver.get("https://www.google.com")

This will work hopefully!

1 Comment

I have tried the PATH = r"C:\PATH\to\chromedriver.exe" but It doesn't use my Chrome User Profile, instead it is using Chrome guest account
1

Instead of writing this:

ch_options = webdriver.ChromeOptions()
ch_options.add_argument("--user-data-dir=C:\\Users\\Dossy\\AppData\\Local\\Google\\Chrome\\User Data")

you can directly give the path

ch_options = webdriver.Chrome('**HERE GIVE  YOUR FULL PATH OF chromedriver.exe**')

like:

chrome = webdriver.Chrome('C:\\Users\\Lucky\\Downloads\\.zip\\chromedriver.exe')

Your browser will open and it and will also redirect you to the link.

1 Comment

I've tried the chrome = webdriver.Chrome('C:\\Users\\Lucky\\Downloads\\.zip\\chromedriver.exe') but It doesn't use my profile, it uses the Guest account
0

If you have problem in first solution and try this: First copy the of chrome driver path: enter image description here

Then,go to the "This PC" and right click on it and then go to the properties: enter image description here

After it go to the advanced system setting: enter image description here

Then, click on Environment Variable enter image description here

Then,In system variable click on Path and then click on edit: enter image description here

Then, click on new : enter image description here

After it,paste the copied path with \chromedriver.exe then click on "Ok": enter image description here

and click "Ok" on all the tabs That's it Now try it Comment if you are having still problem in this.

1 Comment

Try this if having problem comment down.

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.