且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C#中硒的webdriver Firefox配置文件 - 使用代理与认证

更新时间:2022-04-18 22:31:01

你可以做的是创建一个配置文件,并保存在它的认证数据。

What you can do is to create a profile and save the authentication data in it. If your profile is called "webdriver" you can select it from your code in the initialization:

ProfilesIni allProfiles = new ProfilesIni(); 
FirefoxProfile profile = allProfiles.getProfile("WebDriver"); 
profile.setPreferences("foo.bar",23);
WebDriver driver = new FirefoxDriver(profile);