我正在Windows 7上使用Selenium Web Driver。 我试图测试一个需要身份验证并且我需要使用SSL证书的网站。 当我在Selenium之外使用Firefox时一切正常,但是我注意到Selenium打开的Firefox浏览器会话没有注册任何证书,所以很明显不起作用。以下是我使用Firefox“out” of Selenium时的高级首选项:
下面是我使用Selenium打开的Firefox会话的高级首选项:
我已经尝试保持会话打开并手动注册证书,但浏览器会话没有注册证书。以下是我的代码,如果可能会有用:
有任何建议吗?
package myTestProjects;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class GAMOPERA_Test_01 {
private static WebDriver driver = null;
public static void main(String[] args) throws InterruptedException {
// Create a new instance of the Firefox driver
System.out.println("Creo una nuova sessione del browser Firefox ...");
driver = new FirefoxDriver();
//Put a Implicit wait, this means that any search for elements on the page could take the time the implicit wait is set for before throwing exception
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// It is always advisable to Maximize the window before performing DragNDrop action
System.out.println("Massimizzo la finestra del browser ...");
driver.manage().window().maximize();
Thread.sleep(3000L);
//Launch the Sistema Piemonte Home Page
System.out.println("Mi collego a Sistema Piemonte ...");
driver.get("http://<my_site_url>");
Thread.sleep(3000L);
// Find the element Accedi o
System.out.println("Accesso tramite certificato digitale ...");
driver.findElement(By.xpath("/html/body/div[6]/div/div/div[2]/form/table/tbody/tr[3]/td/input")).click();
//driver.findElement(By.className("loginbutton")).click();
Thread.sleep(3000L);
// Print TEST = OK!!
System.out.println("TEST = OK !!");
//driver.quit();
}
}
有任何建议吗?