NullPointerException during using verifyTrue(boolean)
I am using Selenium with Java, TestNG. My java code is as follows:
public static SeleneseTestCase seleneseTestCase;
(class level variable)
@Test(groups = {"All Blank"})
public void a() throws Exception {
selenium.click("btnLogin");
seleneseTestCase.verifyTrue(selenium.isTextPresent("Please enter valid e-mail ID"));
}
While running the application there was an exception on the line
seleneseTestCase.verifyTrue(selenium.isTextPresent("Please enter valid e-mail开发者_运维技巧 ID"));
Exception:FAILED: a
java.lang.NullPointerException
at login.Login.a(Login.java:41)
I need help
Well, at line 41 in the class login.Login, in the method "a", there was a NullPointerException
. It looks as though this is the code that gets called then that button is pressed. That much is obvious from the error message, though, isn't it? You need to go look at Login line 41, and figure out what could be null and why and how you can better handle that condition.
Either selenium
or seleneseTestCase
is null.
You can also make sure that you are performing wait to see 'Please enter valid e-mail ID" Text after click on button.
精彩评论