親愛なる Selenium Webdriver 達人へ
Selenium Webdriver 2 を使用して Firefox を起動するときに FireBug を検出するために、次の 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 にアクセスしているときに、ポップアップ画面から手動で入力することなく、プロキシ サーバーを通過するための追加のステートメントを含むプロキシ設定と認証の詳細を含めようとしています。
また、JVM オプションとして「-Dhttp.proxyHost=proxyserver -Dhttp.proxyPort=80 -Dhttp.proxyUser=jack -Dhttp.proxyPassword=XXXXXXX」を追加しました。
Windows XPおよび7でJava 7、Selenium 2.25.0、Netbeans 7.2を実行しています。
この質問に直接答えた検索はありません。
どんな援助でも大歓迎です。
前もって感謝します、
ジャック