I wrote two Methods Fil开发者_开发问答e name Login.java:
public int multiply(int x, int y) {
return x * y;
}
public void news(){
selenium.open("http://10.0.0.33:8080/Olio/");
}
I call these from a different class named Bank.java
public void testBank() throws Exception {
Login lg = new Login();
System.out.println(lg.multiply(4,8));
lg.news();
Thread.sleep(3000);
}
The first method works, I get 32.
The second method throws a java.lang.NullPointerExpression
.
Why is this happening?
I am guessing that selenium
is null
. Have you instantiated it anywhere ?
精彩评论