0
from selenium import webdriver
driver = webdriver.Chrome('way//to//chromedriver.exe')
driver.get("https://www.youtube.com/")

I'm trying to launch youtube and be already connected on it but I really have no idea what to do, I tried something with cookies but it doesn't work, any idea ?

PROPER EXPLANATION :

When I run this code, it launch youtube but I'm not connected with my youtube account, I'm in "guest" mode. The thing I would like is to be connected on the browser (with my google account) that selenium just launched. So to do this, I'm trying to use cookies but right now nothing works for me.

Madar
  • 196
  • 2
  • 15

2 Answers2

0

I guess you need to use this version : ChromeDriver 87.0.4280.88

0

I just solved the problem !

So here is my code :

from selenium import webdriver
options = webdriver.ChromeOptions() 
options.add_argument("user-data-dir=C:\\Users\\%username%\\AppData\\Local\\Google\\Chrome\\User Data 2")
driver = webdriver.Chrome(executable_path=path,options=options)
driver.get("https://www.google.com") 

If this still doesn't work, here's some links of people that got similar problems :

How to load default profile in chrome using Python Selenium Webdriver?

Selenium gives "selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary" on Mac

Selenium with Firefor or Chrome profile

Madar
  • 196
  • 2
  • 15