New to automation. Help is greatly needed.
Anybody could help me with following code
Why i am I getting NullPointerExceptiona NullPointerException
?
Error: Null pointer access: The variable driver can only be null at this
location
Error: Null pointer accessCode: The variable driver can only be null at this location
Following is another class that iI am calling where iI get the error and it is in seperate Pacakageseparate package than the above.
package common.controls;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class PageVerified
{
public String Verify()
{
WebDriver driver = null ;
String pagetitle = driver.findElement(By.xpath("//*[@id='gb_70']")).getText();
if(pagetitle != null)
{
System.out.println(pagetitle + "Verified Successfully" );
return pagetitle;
}
else
{
System.out.println("Error::Not Verified");
}
return null;
}
}