The following code returns error | Selenium Forum
M
Posted on 19/01/2017
public class YourAccountTest {


@Test
public void accountTest()
{
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().window().maximize();
LaunchPage launchPage=PageFactory.initElements(driver, LaunchPage.class);
SignInPage signIn=launchPage.goToSignInPage();
Object page=signIn.doSignIn("email", "password");

if(page instanceof SignInPage)
{
System.out.println("login failed");
Assert.fail("login failed");
}
else if(page instanceof LandingPage)
{
System.out.println("login passed");
}
LandingPage landingPage=(LandingPage)page;

System.out.println("page casted");
YourOrdersPage yourOrders=landingPage.goToYourOrder();



}
}


login passed
page casted
FAILED: accountTest
java.lang.NullPointerException
at org.openqa.selenium.interactions.Actions.<init>(Actions.java:44)
at com.qtpselenium.amazon.pom.pages.LandingPage.goToYourOrder(LandingPage.java:31)
at com.qtpselenium.amazon.pom.testcases.YourAccountTest.accountTest(YourAccountTest.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:773)
at org.testng.TestRunner.run(TestRunner.java:623)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)

M
Replied on 19/01/2017

java.lang.NullPointerException is caused because of many reasons. try debugging with eclipse

http://www.vogella.com/tutorials/EclipseDebugging/article.html#debugging-support-in-eclipse