I get NullPointerException when I run this code -
File src = new File("C:\\myxl.xlsx");
FileInputStream fis = new FileInputStream(src);
XSSFWorkbook wb = new XSSFWorkbook(fis);
XSSFSheet sh1 = wb.getSheetAt(0);
String mystr=sh1.getRow(1).getCell(4).getStringCellValue();
WebElement mwe = driver.findElement(By.xpath("//div[@title='" + mystr + "']"));
if (mystr.contains(null))
{
System.out.println("there is Nothing");
}
else
{
act.doubleClick(mwe).perform();
What do I change in the code so that if the value in that column and row is empty it will print "there is Nothing" instead of giving me a NullPointerException or else it will take some action with the element.
P.S. This is part a of a Selenium webdriver script