Unable to load default profile in Chrome with Selenium WebDriver

别等时光非礼了梦想. 提交于 2019-12-21 17:54:04

问题


I am using Selenium WebDriver to do something on a page that requires http authentication.

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.

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? =)


回答1:


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");


来源:https://stackoverflow.com/questions/18034747/unable-to-load-default-profile-in-chrome-with-selenium-webdriver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!