亲爱的硒webdriver的大师,无法设置Firefox的配置和代理设置和认证Java中
我已经在尝试使用硒的webdriver 2启动Firefox时,提出了以下的Firefox配置文件设置更改皮卡萤火虫:
public static void main(String[] args)
{
File fireBugFile = new File("C:/selenium-ide-1.9.0.xpi");
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.addExtension(fireBugFile);
firefoxProfile.setPreference("network.proxy.type", 1);
firefoxProfile.setPreference("network.proxy.http", "proxyserver");
firefoxProfile.setPreference("network.proxy.http_port", "80");
firefoxProfile.setPreference("extensions.firebug.currentVersion", "1.9.0");
String urlStrProxy = "http://www.example.com/",
proxy = "proxyserver",
port = "80",
username = "jack",
password = "XXXXXXX";
Authenticator.setDefault(new SimpleAuthenticator(username,password));
Properties systemProperties = System.getProperties();
systemProperties.setProperty("http.proxyHost",proxy);
systemProperties.setProperty("http.proxyPort","80");
WebDriver driverMainPage = new FirefoxDriver(firefoxProfile);
}
public class SimpleAuthenticator extends Authenticator
{
private String username, password;
public SimpleAuthenticator(String username,String password)
{
this.username = username;
this.password = password;
}
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(username,password.toCharArray());
}
}
也试图包括代理设置额外的语句通过代理服务器,以获得&认证细节没有 不必手动通过一个弹出屏幕上输入他们时,Firefox是访问www.abc.com没有成功:
还添加了“-Dhttp.proxyHost = proxyserver -Dhttp.proxyPort = 80 -Dhttp.proxyUser = jack -Dhttp.proxyPassword = XXXXXXX”作为JVM选项。
我在Windows XP上运行的Java 7,硒2.25.0,Netbeans的7.2 & 7.
无搜查都直接回答了这个问题。
任何援助将非常感激。
由于提前,
杰克
感谢Abhi_Mishra为您的回应。在Selenium Webdriver中使用firefoxprofile启动Firefox时无法加载Firebug的问题如何?谢谢,杰克 –