问题
I want to run UI Tests using selenium (WebDriver) as different user.
string[] rolesArray = {"Admin", "Manager"};
Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("ik\adam.walas@com.pl"), rolesArray);
I put these code inside constructor WebDriver. However when I run single UI Test using Visual Studio, the test runs as a user who is logged on computer so my account. How can I solve this issue? I use Chrome as a browser for UI Tests. Should I use selenium chromedriver with ChromeOptions to workaround this?
来源:https://stackoverflow.com/questions/47548706/run-ui-tests-using-selenium-webdriver-as-different-user