Run UI Tests using Selenium (WebDriver) as different user

巧了我就是萌 提交于 2020-01-03 04:54:08

问题


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

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