Null Pointer Exception when running selenium webdriver testcase using internet explorer driver -
below code:
package mypackage; import java.io.file; import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.ie.internetexplorerdriver; public class myclass { public static webdriver driver; public static file file; public static void main (string[] args){ // declaration , instantiation of objects/variables file = new file("c:\\data\\iedriverserver_x64_2.42.0\\iedriverserver.exe"); system.setproperty("webdriver.ie.driver", file.getabsolutepath()); driver = new internetexplorerdriver(); string baseurl = "http://www.google.com"; string expectedtitle = "google"; string actualtitle = ""; // launch ie , direct base url driver.get(baseurl); // actual value of title actualtitle = driver.gettitle(); /* * compare actual title of page witht expected 1 , print * result "passed" or "failed" */ if (actualtitle.contentequals(expectedtitle)){ system.out.println("test passed!"); } else { system.out.println("test failed"); } //close firefox driver.close(); // exit program explicitly system.exit(0); } }
when run following exception.
started internetexplorerdriver server (64-bit) 2.42.0.0 listening on port 42229 exception in thread "main" java.lang.nullpointerexception @ org.openqa.selenium.remote.remotewebdriver.execute(remotewebdriver.java:600) @ org.openqa.selenium.remote.remotewebdriver.startsession(remotewebdriver.java:241) @ org.openqa.selenium.remote.remotewebdriver.startsession(remotewebdriver.java:226) @ org.openqa.selenium.ie.internetexplorerdriver.run(internetexplorerdriver.java:182) @ org.openqa.selenium.ie.internetexplorerdriver.<init>(internetexplorerdriver.java:174) @ org.openqa.selenium.ie.internetexplorerdriver.<init>(internetexplorerdriver.java:146) @ mypackage.myclass.main(myclass.java:15)
i have problem. have tried both 32 , 64 bit drivers. using ie11 , have followed selenium documentation configuration ie11 , updated windows registry. https://code.google.com/p/selenium/wiki/internetexplorerdriver#required_configuration
Comments
Post a Comment