开发者

Null pointer exception in selenium RC Using java

开发者 https://www.devze.com 2023-02-25 08:33 出处:网络
I wrote two Methods Fil开发者_开发问答e name Login.java: public int multiply(int x, int y) { return x * y;

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 ?

0

精彩评论

暂无评论...
验证码 换一张
取 消