Run UI Tests using Selenium (WebDriver) as differe

2019-06-12 11:50发布

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?

0条回答
登录 后发表回答