dimanche 28 août 2016

I am getting error "java.lang.NullPointerException"

I am using selenium Webdriver for the testing web application. I am using marioette driver for the same as I am havin firefox 48.0 since yusing the same the web page gets open however I am not able to put the values in the text box it gives the error " java.lang.NullPointerException" I have written code

@BeforeTest
          public void setUp() throws Exception {
                 System.setProperty("webdriver.gecko.driver", "D:\\ashwini\\geckodriver.exe");
        
                  driver= new MarionetteDriver();

            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
          }

@Test
          public void testAddAccount() throws Exception {
            driver.get("http://ift.tt/2btTiz8");
            
            driver.findElement(By.id("username")).clear();
            driver.findElement(By.id("username")).sendKeys("cp_admin");
}


@AfterTest
          public void teardown()
          {
                  driver.quit();
          }



Output is: 


1472448949884   Marionette      INFO    sendAsync 3744f8a9-772e-42fe-8c85-6f9964888fb1
FAILED: testAddAccount
java.lang.NullPointerException
        at Add_Account.testAddAccount(Add_Account.java:36)
        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)

Aucun commentaire:

Enregistrer un commentaire