import org.testng.annotations.*;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class redc {
public static WebDriver driver=null;
public static void startdriver()
{
String key="webdriver.gecko.driver";
String path="C:\\selenium3\\geckodriver\\geckodriver.exe";
System.setProperty(key,path);
driver = new FirefoxDriver();
}
@BeforeMethod
public void call()
{
}
@Test
public void t1()
{
driver.get("https://www.dynamiclevels.com/");
}
I am trying to run this code but constantly getting error
FAILED: t1 java.lang.NullPointerException at datac.redc.t1(redc.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
Please help me correct the code. If possible rewrite it in in a way it would work. I am sure i am making same silly mistake i cant catch. :(