0

I have a problem. I work with Selenium Webdriver and would like to change the user profile from one user to another. e.g. user1 is a regular user user 2 has administrable rights

Will run a test case with common user with certain steps. Then comes admin and approve such a post in the "wordpress" in another test case

grateful for any help

Magnus L
  • 63
  • 10
  • Possible duplicate of [How can I add profile preferences to Chrome for Selenium Grid 2 in C#?](http://stackoverflow.com/questions/22200648/how-can-i-add-profile-preferences-to-chrome-for-selenium-grid-2-in-c) – Mobrockers Jun 16 '16 at 09:15

1 Answers1

1
ChromeOptions regularUser = new ChromeOptions();
ChromeOptions adminUser = new ChromeOptions();
regularUser.addUserProfilePreference(yourRegularUserPreferences);
adminUser.addUserProfilePreference(yourAdminUserPreferences);

//When testing regular user
WebDriver driver = new RemoteWebDriver(new Uri("http://path/to/selenium/server"), regularUser.toCapabilities());

//When testing admin user
WebDriver driver = new RemoteWebDriver(new Uri("http://path/to/selenium/server"), adminUser.toCapabilities());
Mobrockers
  • 2,128
  • 1
  • 16
  • 28