当前在使用默认浏览器使用Selenium打开Chrome时遇到问题。我已通过AddArgument函数为我的用户数据配置文件指定了正确的路径。 (当我访问chrome:// version /登录时指定的那个)。但是,无论我如何无法访问登录的默认chrome实例,这都是我使用的代码。
static void Main(string[] args)
{
ChromeOptions options = new ChromeOptions();
options.AddArgument(@"user-data-dir=C:\Users\user\AppData\Local\Google\Chrome\User Data\Profile 2");
ChromeDriver chromeDriver = new ChromeDriver(options);
chromeDriver.Navigate().GoToUrl("https://www.google.com/");
}
答案 0 :(得分:1)
Chrome浏览器具有用于存储配置文件的用户数据目录。在此目录中,可以维护多个配置文件。可以使用两个参数
如果仅指定user-data-directory
,则将使用同一目录中的Default
目录。如果指定了profile-directory
,那么将使用user-data-directory
内部的目录