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)
私は2つのクラスを持っています。1つは定義用(class-1)で、もう1つはテスト用(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
}
親切に助けて