Error:
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
java.lang.NullPointerException
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)
Code:
public void reportStep(String desc, String status) {
long snapNumber = 100000l;
try {
snapNumber= takeSnap();
} catch (Exception e) {
e.printStackTrace();
}
// Write if it is successful or failure or information
if(status.toUpperCase().equals("PASS")){
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 {
driver.findElement(By.name("userId")).sendKeys(Uname);
reportStep("The element : "+Uname+" is passed "+Uname, "PASS"); --->error
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
reportStep("WebDriverException"+e.getMessage(), "FAIL");
}
return this;
reportStep(Reporter.java:29)
. Can you please share what code of line is there ?desc
is passing null in method. CheckLoginapplcn()
methodUname
value is null. Or your screenshot is not capture intest.addScreenCapture()
method