Hi I’m new to automation and trying to learn by myself

While developing keyword driven frame work getting following exceptions


Exception in thread "main" java.lang.NullPointerException

at config.ActionKeywords.navigate(ActionKeywords.java:19)

at ExecuteEngine.DriverScript.main(DriverScript.java:29)

even I tried to copy and run the entire code as it isĀ  but still getting this exception ??

Default Asked on October 10, 2014 in Selenium WebDriver.
Add Comment
  • 1 Answer(s)

    Hi,

    It says that error is in Config package, Action Keywords class and Navigate method. But it is hard to tell the cause of exception without looking in to the code. There are few things you can check at your side:

    1) As we have followed the concept of reflection class, navigate method is accepting two arguments (Object & Data), even though we are not passing any arguments to this method but still we need to mention this in the method declaration, this is the prerequisite for the reflection class that all the methods will have same argument list.

    2) Check the code again:

    
    public static void navigate(String object, String data){
    
    try{
    
    Log.info("Navigating to URL");
    
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    
    driver.get(Constants.URL);
    
    }catch(Exception e){
    
    Log.info("Not able to navigate --- " + e.getMessage());
    
    DriverScript.bResult = false;
    
    }
    
    }
    
    

    3) As there will be a log file generated, see till what steps the script is executed. It will give you the idea where the problem is.

    Regards,
    Lakshay Sharma

    Professor Answered on October 11, 2014.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.