无法加载默认的配置文件在Chrome与硒的webdriver [英] Unable to load default profile in Chrome with Selenium WebDriver
问题描述
我使用webdriver的硒要做到这一点需要HTTP验证的网页上的东西。
I am using Selenium WebDriver to do something on a page that requires http authentication.
我已经登录我的默认配置文件。但是chromedriver将自动使用一个新的配置文件每次使用硒,因此我不能让过去的验证阶段。
I am already login in my default profile. But the selenium chromedriver will automatically use a new profile for each use therefore I can't get past the authentication stage.
所以,我想用我的默认配置文件(用内帐户登录)硒的webdriver的Chrome浏览器。
Therefore, I was thinking of using my default profile (With account login inside) on Selenium WebDriver for Chrome.
默认的配置文件似乎并没有被加载到浏览器,甚至当我使用的代码如下
The default profile don't seem to be loaded into Chrome even when I use the code as below
ChromeOptions options = new ChromeOptions();
options.AddArguments("user-data-dir=C:/Users/user_name/AppData/Local/Google/Chrome/User Data/Default");
IWebDriver driver = new ChromeDriver(@"C:\Users\Lawrence\Desktop\selenium-dotnet-2.33.0\net40",options);
任何帮助吗? =)
Any help? =)
推荐答案
尝试添加 - 您的Chrome开关之前,并删除默认$ C 。$ C>从路径逃生斜线如有必要
Try add '--' before your Chrome switch and remove Default
from path, escape slashes if necessary.
options.AddArguments("--user-data-dir=C:\\Users\\user_name\\AppData\\Local\\Google\\Chrome\\User Data");
这篇关于无法加载默认的配置文件在Chrome与硒的webdriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!