繁体   English   中英

如何使用Selenium Webdriver以其他用户身份运行firefox浏览器?

[英]How to run firefox browser as a different user with Selenium Webdriver?

我正在Selenium测试中尝试以其他用户身份运行Firefox。 如何告诉Selenium以“指定”用户身份运行? 我的应用程序具有Windows身份验证,并且我需要运行具有不同角色的测试。

这可以通过创建Firefox配置文件来完成,使用firefox.exe -p启动配置文件管理器

根据需要创建配置文件后,请使用配置文件名称并启动驱动程序:

ProfilesIni profile = new ProfilesIni();

FirefoxProfile myprofile = profile.getProfile("profileName");

WebDriver driver = new FirefoxDriver(myprofile);

希望这可以帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM