$host = ' $options = new ChromeOptions() Use Facebook\WebDriver\Chrome\ChromeOptions Use Facebook\WebDriver\Remote\RemoteWebDriver
#GOOGLE XHROME USER DATA DIRECTORY CODE#
My Code in PHP: namespace Facebook\WebDriver If you want to run Chrome using your default profile (cause you need a extension), you need to run your script using another browser, like Microsoft Edge or Microsoft IE and your code will lunch a Chrome instance. Observe Chrome gets initialized with the Chrome Profile as SeLeNiUm.M_Options.AddArgument("-user-data-dir=C:/Users/Me/AppData/Local/Google/Chrome/User Data/Profile 2") Now pass the value of profile-directory through an instance of ChromeOptions with AddArgument method along with key user-data-dir as follows : m_Options = new ChromeOptions() Get the absolute path of the profile-directory in your system as follows : C:\\Users\\Thranor\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 2 From the properties of the desktop icon SeLeNiUm - Chrome get the name of the profile directory.Now a desktop icon will be created as SeLeNiUm - Chrome.Click on ADD PERSON, provide the person name, select an icon, keep the item Create a desktop shortcut for this user checked and click on ADD button.In People section, click on Manage other people on which a popup comes up.Open Chrome browser, click on the Side Menu and click on Settings on which the url chrome://settings/ opens up.To create and open a new Chrome Profile you need to follow the following steps : Hence you should always use a customized Chrome Profile as below. So the Default Chrome Profile may not be in compliance with you Test Specification and may raise exception while loading. I'm not sure what else to try.Īs per your code trials you were trying to load the Default Chrome Profile which will be against all the best practices as the Default Chrome Profile may contain either of the following: M_Options.AddArgument("-disable-extensions") M_Options.AddArgument("-profile-directory=Default") M_Options.AddArgument("-user-data-dir=C:/Users/Me/AppData/Local/Google/Chrome/User Data") It still hangs for 60 seconds even without another browser open. The reading I've done points to not being able to have more than one browser open at a time with the same profile so I made sure nothing was open while I ran the program. If I don't use the user data dir and profile settings, it works fine but doesn't use my profile. This loads the browser with my profile like i want, but the browser then hangs for 60 seconds and times out without advancing through any more of the automation. I can get this working using ChromeOptions to set the userdatadir and profile directory. I am attempting to load a chrome browser with selenium using my existing account and settings from my profile.