This is my code. It opens Google Chrome but does not go to google.com
:
from selenium import webdriver
path = r'C:\Program Files\Google\Chrome\Application\chrome.exe'
options = webdriver.ChromeOptions()
path = r'C:\Program Files\Google\Chrome\Application\chrome.exe'
options.add_argument(f'--user-data-dir={path}')
options.add_argument('--profile-directory=Default')
chrome_browser = webdriver.Chrome(executable_path=path, options=options)
chrome_browser.get('https://google.com/')
But if I use this, it opens Selenium's Chrome and works (no cache or cookie from my Google Chrome) (edit 1):
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
# path = r'C:\Program Files\Google\Chrome\Application\chromedriver.exe'
path = r'D:\Downloads\chromedriver_win32\chromedriver.exe'
options = webdriver.ChromeOptions()
user_data = r'C:\Users\Saeed\AppData\Local\Google\Chrome\User Data'
options.add_argument(f'--user-data-dir={user_data}')
options.add_argument('--profile-directory=Default')
driver = webdriver.Chrome(f'{path}', options=options)
driver.get('https://google.com')
Where's the issue?
Edit2
In fact when I use chromedriver.exe
WITHOUT profile, it opens chrome driver with no history, passwords, etc.
But when I use chromedriver.exe
WITH profile, it opens normal chrome but does not open the web page.