In Hybrid Framework Reflection concept is not working | Selenium Forum
S
suhail.itm Posted on 20/06/2019

In my framework project , i read the function name form excel file and execute the function through reflection concept .

try {
Method method;
method=app.getClass().getMethod(KeywordKey);
method.invoke(app);


}catch(Exception ex) {
Throwable c=ex.getCause();
System.out.println(c.getMessage());
}

 

Above code is executed successfully for first "KeywordKey" but give nullpointerexception for  second "KeywordKey"


A
Ashish Thakur Replied on 24/06/2019

NullPointerException comes when the code is not able to find the method(Function) name with the data specified in the method.invoke("function name")