When I run this code
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--disable-infobars")
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument(r"user-data-dir=C:\Users\micha\AppData\Local\Google\Chrome\User Data\Profile 1")
driver = webdriver.Chrome(executable_path=r'C:\Users\micha\Desktop\Visual_projects\chromedriver.exe', chrome_options = chrome_options)
driver.get("https://store.steampowered.com/")
This error pops up :
[12216:1336:0411/232857.718:ERROR:browser_switcher_service.cc(238)] XXX Init()
Could someone please help me. I don't know what is wrong but the program won't open the new profile I created. Any help would be appreciated.
I searched everywhere how to fix this error but I think the guides are outdated
Best Answer
Not exactly answer to your question. But I found this link very useful.
Also, I see you are trying to include user dir options. Actually, this is not required since it creates a temporary directory while launching
chromedriver.exe
.To know options for
chromedriver.exe
-chromedriver.exe -h
is of great help.See example below which works great at my end. Also, I prefer to use paths without spaces in windows, it helps keep things simple. If you use
--verbose
instead of--log-level=INFO
you will get all logs.In the chromedriver log, you can see the default arguments given to the
chromedriver.exe
.service.stop()
terminates thechromedriver.exe
or else it will keep running in the background.Folder structure at my end is like below:
Also, created as
killchromedriver.py
file to terminate allchromedriver.exe
instances in case they are running in background.Update: Adding options to remove the infobars and save password popups