Starting ChromeDriver 2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f) on port 8745
Only local connections are allowed.
Feb 01, 2018 1:09:16 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
    at utils.Reporter.reportStep(Reporter.java:29)
    at pages.Login.Loginapplcn(Login.java:18)
    at testcases.TestCase01.TC01(TestCase01.java:37)
    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)


    public void reportStep(String desc, String status) {

    long snapNumber = 100000l;

    try {
        snapNumber= takeSnap();
    } catch (Exception e) {

    // Write if it is successful or failure or information
        test.log(LogStatus.PASS, desc+test.
                addScreenCapture("C:\\Users\\wb469604\\Anu\\Selenium_Handson\\CFA_Automation_New\\screenshot"+snapNumber+".jpg")); --------------> error in this step
    }else if(status.toUpperCase().equals("FAIL")){
        test.log(LogStatus.FAIL, desc+test.addScreenCapture("C:\\Users\\wb469604\\Anu\\Selenium_Handson\\CFA_Automation_New\\screenshot"+snapNumber+".jpg"));
        throw new RuntimeException("FAILED");
    }else if(status.toUpperCase().equals("INFO")){
        test.log(LogStatus.INFO, desc);
    }else if(status.toUpperCase().equals("WARN")){
        test.log(LogStatus.WARNING, desc+test.addScreenCapture("./../reports/images/"+snapNumber+".jpg"));

Code of the page:

 public Login Loginapplcn(String Uname)

            try {
                reportStep("The element : "+Uname+" is passed "+Uname, "PASS"); --->error
                            } catch (Exception e) {
                // TODO Auto-generated catch block
                reportStep("WebDriverException"+e.getMessage(), "FAIL");

        return this;
  • In reportStep method, see this line reportStep(Reporter.java:29). Can you please share what code of line is there ?
    – Sagar007
    Feb 1 '18 at 8:11
  • test.log(LogStatus.PASS, desc+test. addScreenCapture("C:\\Users\\wb469604\\Anu\\Selenium_Handson\\CFA_Automation_New\\screenshot"+snapNumber+".jpg"));
    – Anu
    Feb 1 '18 at 9:03
  • As per my understanding, desc is passing null in method. Check Loginapplcn() method Uname value is null. Or your screenshot is not capture in test.addScreenCapture() method
    – Sagar007
    Feb 1 '18 at 9:54

Missed to pass extenttest in the constructor. update it and code worked.

public Login(WebDriver driver, ExtentTest test){
        Login.driver = driver;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.