这是我的问题。
执行testNG脚本后,我收到错误说明
org.testng.TestNGException:
无法实例化类TestNG.DemoTestNG。任何人都可以给我解决我的问题的方法。
public class DemoTestNG {
WebDriver driver = new FirefoxDriver();
String appUrl = "http://192.168.1.116:9090/soxaudit/login";
@Test
public void Sox_Login() {
driver.get(appUrl);
driver.manage().window().maximize();
String expectedTitle = "SOX ADMIN - LOGIN";
String actualTitle = driver.getTitle();
Assert.assertEquals(expectedTitle,actualTitle);
WebElement username = driver.findElement(By.id("j_username"));
username.clear();
username.sendKeys(new String[]{"sox"});
WebElement password = driver.findElement(By.id("j_password"));
password.clear();
password.sendKeys(new String[]{"welcome@123"});
WebElement SignInButton = driver.findElement(By.xpath("//*[@id='login-page']/div/form/div/button"));
SignInButton.click();
// close the web browser
driver.close();
System.out.println("Test script executed successfully.");
// terminate the program
System.exit(0);
}
}