获取NullPointerException,无法解决它

时间:2019-11-16 13:00:51

标签: nullpointerexception

我在执行代码时收到NullPointerException。请研究此代码,并为此提供帮助。

软件包Selenium_Excersice;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;


public class Chrome_Launch {

    public WebDriver drw;
    public static void main(String[] args) throws InterruptedException {

        WebDriver drw = new ChromeDriver();
        drw.get("http://www.amazon.in/");
        drw.manage().window().maximize();
        Thread.sleep(3000);

        Login lgn = new Login();
        lgn.Amazon_Login();
}
}

class Login extends Chrome_Launch {

    void Amazon_Login() 
    {
        System.out.println("Amazon site is opened successfully");
        drw.findElement(By.xpath("//div[@id='nav-signin-tooltip']//span[@class='nav-action-inner'][contains(text(),'Sign in')]")).click();
}

}

0 个答案:

没有答案