您好我正在尝试在 TestNG 类中运行一个测试用例,我可以在其中获得报告和编号测试失败或通过测试用例以下代码在普通 java 类中运行时有效...
@Test
public void make() throws InterruptedException{
System.setProperty("webdriver.chrome.driver","C:\\Users\\sasy\\Desktop\\Akhil\\Selenium\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
System.setProperty("org.apache.commons.logging.Log","org.apache.commons.logging.impl.Jdk14Logger");
driver.get("http://198.57.218.124/CRFGLSPL/Private/login.aspx?ReturnUrl=%2fCRFGLSPL%2fPrivate%2fPatientOrganDamageIntermediateVisit.aspx%3fPatientID%3d2&PatientID=2");
driver.findElement(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_txtEmail']")).sendKeys("nikhil@gmail.com");
driver.findElement(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_txtPassword']")).sendKeys("maryme");
driver.findElement(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_btnLogin']")).click();
driver.findElement(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_btnSubmit']")).click();
driver.findElement(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_btnSubmit']")).click();
//WebElement ID418=driver.findElement(By.xpath("//*[@id='edit41']"));
//WebElement ID830=driver.findElement(By.xpath("//*[@id='edit40']"));
WebElement ID969=driver.findElement(By.xpath("//*[@id='edit37']"));
//WebElement ID472=driver.findElement(By.xpath("//*[@id='edit39']"));
Thread.sleep(3000);
ID969.click();
driver.quit();
}
当上面的代码作为 TestNG Test 运行时,我得到以下错误
FAILED: make java.lang.NoClassDefFoundError: com/google/common/base/Function at first.heha.make(heha.java:16)