How to resolve below code I am getting null pointer exception

package com.healthec.pd;
import com.healthec.genericlib.*;
import com.healthec.pagerepo.*;
import java.io.IOException;
import java.util.List;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class PdAddProviderTestPage {
public WebDriver driver;
@BeforeClass
public void ConfigureBeforeClass() throws Exception
{
driver=Browsercapability.getBrowser();
driver.manage().window().maximize();
Webdrivercommonlib.waitforpageload();
}
@BeforeMethod
public void ConfigureBeforeMethod() throws InterruptedException, EncryptedDocumentException, InvalidFormatException, IOException{
driver.get(Constants.url);
Thread.sleep(5000);
String username=Excelsheet.getdata(“D:/UserDetails/data/data.xlsx”,”Sheet2″,1,0);
String password=Excelsheet.getdata(“D:/UserDetails/data/data.xlsx”,”Sheet2″,1,1);
System.out.println(username);
System.out.println(password);
Login_TC_383 login=new Login_TC_383(driver);
login.logintoapp(username, password);
}
@Test
public void Provider() throws Exception
{
driver=new FirefoxDriver();
driver.findElement(By.id(“lnkProviderAdmin”)).click();
driver.findElement(By.xpath(“.//*[@id=’9011′]”)).click();
Thread.sleep(3000);
driver.findElement(By.id(“ContentPlaceHolder1_btnAddProvider”)).click();
driver.findElement(By.id(“ContentPlaceHolder1_btnPrimaryAssignAccount”)).click();
driver.findElement(By.className(“form_label”)).click();
Select sct=new Select(driver.findElement(By.id(“ContentPlaceHolder1_ddlTaxonomyCodeSet”)));
sct.selectByIndex(3);
Thread.sleep(3000);
driver.findElement(By.id(“ContentPlaceHolder1_btnSecondaryAssignAccount”)).click();
List<WebElement> lst=driver.findElements(By.id(“grdAccountList_chkBoxSelectAllAccountId”));
int count=lst.size();
System.out.println(“No of boxes :”+count);
for(int i=0;i<count;i++)
{
String value=lst.get(i).getAttribute(“Account Name”);
if(value.equalsIgnoreCase(“Account Name”))
{
lst.get(i).click();
break;
}
}
driver.findElement(By.id(“btnAssignUserAccount”)).click();
driver.findElement(By.xpath(“.//*[@id=’content_inner’]/table[1]/tbody/tr[1]/td[2]”)).click();
Select sct1=new Select(driver.findElement(By.id(“ContentPlaceHolder1_ddlProviderTypeId”)));
sct1.selectByIndex(2);
Thread.sleep(3000);
driver.findElement(By.xpath(“.//*[@id=’content_inner’]/table[1]/tbody/tr[2]/td[1]”)).click();
driver.findElement(By.id(“ContentPlaceHolder1_txtLastName”)).sendKeys(Keys.ENTER);
driver.findElement(By.xpath(“.//*[@id=’content_inner’]/table[1]/tbody/tr[2]/td[3]”)).click();
driver.findElement(By.id(“ContentPlaceHolder1_txtMiddleName”)).sendKeys(Keys.ENTER);
driver.findElement(By.xpath(“.//*[@id=’content_inner’]/table[1]/tbody/tr[2]/td[5]”)).click();
driver.findElement(By.id(“ContentPlaceHolder1_txtFirstName”)).sendKeys(Keys.ENTER);
driver.findElement(By.xpath(“.//*[@id=’content_inner’]/table[1]/tbody/tr[3]/td[1]”)).click();
driver.findElement(By.id(“ContentPlaceHolder1_txtTitle”)).sendKeys(Keys.ENTER);
driver.findElement(By.xpath(“.//*[@id=’content_inner’]/table[1]/tbody/tr[3]/td[3]”)).click();
driver.findElement(By.id(“ContentPlaceHolder1_txtDegree”)).sendKeys(Keys.ENTER);
driver.findElement(By.xpath(“.//*[@id=’content_inner’]/table[1]/tbody/tr[3]/td[5]”)).click();
driver.findElement(By.id(“ContentPlaceHolder1_txtSuffix”)).sendKeys(Keys.ENTER);
driver.findElement(By.xpath(“.//*[@id=’content_inner’]/table[2]/tbody/tr[1]/td[1]”)).click();
driver.findElement(By.id(“ContentPlaceHolder1_txtNPI”)).sendKeys(Keys.ENTER);
driver.findElement(By.xpath(“.//*[@id=’content_inner’]/table[2]/tbody/tr[1]/td[3]”)).click();
driver.findElement(By.id(“ContentPlaceHolder1_txtTaxId”)).sendKeys(Keys.ENTER);
driver.findElement(By.id(“ContentPlaceHolder1_btnSaveProvider”)).click();
System.out.println(“I am in Provider test class”);
}
@AfterMethod
public void ConfigureAfterMethod() throws Exception
{
Logout_TC_02 logout=new Logout_TC_02(driver);
logout.logouttoapp();
}
@AfterClass
public void ConfigureAfterClass() throws Exception
{
driver.quit();
}
}

Default Asked on March 31, 2017 in Selenium WebDriver.
Add Comment
  • 1 Answer(s)

    Will be easy if it can be reproduced.. can you send the url and the logins.

    Supporter Answered on April 6, 2017.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.