C# Selenium Start Chrome with Different User Profile

蹲街弑〆低调 提交于 2019-12-05 16:30:48

You din't use the options objects at all.

IWebDriver driver = new ChromeDriver();

Should be

IWebDriver driver = new ChromeDriver(options);

Edit-1 - Chrome profiles and users

Chrome has User data directory for storing profiles. Inside this directory multiple profiles can be maintained. There are two arguments that can be used

  • user-data-directory
  • profile-directory

If only user-data-directory is specified then a Default directory inside the same would be used. If profile-directory is specified then that directory inside the user-data-directory is used

If you are starting with the profile of the browser on the computer you are looking for, you can

  1. Open normal google chrome and go to ('chrome://version') enter link description here
  2. Copy the Profile Path but take all of the "Data" folder and copy it to where the program is running
  3. C# Coding:

    https://rextester.com/INK23784

By creating a folder named "profile" where the program is running, you can add all the profile information, plugins, and so on. etc. We have copied the data folder in everything and when opening the browser "ChromeOptions" to selenium your profile files, etc. that's everything

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