2

I want to use native google chrome's profile in selenium.

ChromeOptions options = new ChromeOptions();
options.AddArgument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36");
options.AddArgument("user-data-dir=C:/Users/Administrator/AppData/Local/Google/Chrome/User Data/Profile 1");
options.AddArgument("--profile-directory=Profile 1");

var driverService = ChromeDriverService.CreateDefaultService(new FileInfo(Application.ExecutablePath).DirectoryName);
            driverService.HideCommandPromptWindow = true;
var driver = new ChromeDriver(driverService, options);

driver.Navigate().GoToUrl("https://example.com/profile");

But it seems the profile not recognized by selenium. because when it lunch there is no bookmark(that I added in native google chrome) and I already login to example.com but when I go to the URL by selenium, the login page appears!

I use this and this but it does not work!

and this article it seems to work on phyton but I don't know how to change it for chrome.

joei
  • 333
  • 2
  • 11

0 Answers0