新设置 eclipse 和 TestNG。我已经从 selenium 网站下载了 Jar 文件 zip,但是在执行示例 FAILED CONFIGURATION: @BeforeMethod setUp java.lang.NoClassDefFoundError: iscoming
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.Assert;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Login {
private WebDriver driver;
private String baseUrl;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
@BeforeMethod
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = "http://tssgmsw006:8080";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testLogin() throws Exception {
driver.get(baseUrl + "/GSSR/views/supplierSelectionAction.action");
driver.findElement(By.linkText("Advanced")).click();
driver.findElement(By.linkText("Basic")).click();
}
@AfterMethod public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
Assert.fail(verificationErrorString);
}
}
}
输出:-
FAILED CONFIGURATION: @BeforeMethod setUp java.lang.NoClassDefFoundError: com/google/common/base/Function