2012-07-26 21 views
1

目前我已經包含以下JAR文件來使用JAVA回放硒記錄。訪問Selenium類功能所需的Jar文件

  1. 的JUnit 4.10.jar
  2. 硒-java的2.24.1.jar
  3. 硒的服務器獨立-2.24.1.jar

而且我已經導入這些包

import com.thoughtworks.selenium.Selenium; 
import java.util.NoSuchElementException; 
import java.util.concurrent.TimeUnit; 

import org.junit.After; 
import static org.junit.Assert.fail; 
import org.junit.Before; 
import org.junit.Test; 

import org.openqa.selenium.Alert; 
import org.openqa.selenium.By; 
import org.openqa.selenium.NoAlertPresentException; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.WebElement; 
import org.openqa.selenium.firefox.FirefoxDriver; 
import org.openqa.selenium.htmlunit.HtmlUnitDriver; 
import org.openqa.selenium.support.ui.Select; 

但是就這些而言,我無法訪問像getAlert()或getConfirmation()這樣的selenium類函數。

那麼有沒有我錯過的任何庫文件或JAR文件?

+2

'getAlert()'和'getConfirmation()'都在'com.thoughtworks.selenium.DefaultSelenium'中實現,它包含在_selenium-java-2.24.1.jar_中。你得到了什麼確切的錯誤? – VolkerK 2012-07-27 10:44:19

回答

0

您沒有導入com.thoughtworks.selenium包中的DefaultSelenium類,因此將此行添加到您的代碼中,它將起作用。

import com.thoughtworks.selenium.DefaultSelenium;

+0

嘿,有沒有任何引用鏈接來獲得這個包,這個包'import com.thoughtworks.selenium.DefaultSelenium' – Bose 2017-01-04 07:42:08

1

您可以從Selenium HQ site下載Java Client驅動程序包2.25.0,然後添加項目引用庫中的所有jar。