簡體   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