Testng布尔断言java.lang.ExceptionInInitializerError

时间:2014-04-28 09:28:17

标签: selenium-webdriver testng reportng

运行Testng程序时出现此错误:

java.lang.ExceptionInInitializerError
    at com.org.dnb.po.test.loginpagePOTest.verifyLoginpagecontrols(loginpagePOTest.java:58)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)

我有两个用于定义的类(class-1),另一个用于test(class-2)

第1课:

public static List<WebElement> unameBox1= driver.findElements(By.xpath(".//*[@id='username']"));
public static boolean unameboxIT = unameBox1.size() > 0;

等级2:

@Test(priority=1)
public void verifyLoginpagecontrols(){

    Assert.assertTrue(unameboxIT); // Always goes into Exception as shown above
}

请帮助

0 个答案:

没有答案