获取java.lang.IllegalArgumentException:Selenium驱动程序脚本中的参数数目错误
我正在处理Selenium关键字框架。下面是我的代码段。我的脚本工作正常,但我不明白为什么会出现此错误。请帮助我解决此异常 主类获取java.lang.IllegalArgumentException:Selenium驱动程序脚本中的参数数目错误,java,selenium,selenium-webdriver,Java,Selenium,Selenium Webdriver,我正在处理Selenium关键字框架。下面是我的代码段。我的脚本工作正常,但我不明白为什么会出现此错误。请帮助我解决此异常 主类 public static void main(String args[]) throws Exception { ExcelUtils.setExcelFile(Cls_constant.testDataPath, Cls_constant.testDataFile, "Sheet1"); //
public static void main(String args[]) throws Exception {
ExcelUtils.setExcelFile(Cls_constant.testDataPath,
Cls_constant.testDataFile, "Sheet1");
// int rowCount =
// ExcelUtils.worksheet.getLastRowNum()-ExcelUtils.worksheet.getFirstRowNum();
for (int irow = 1; irow <= 6; irow++) {
sActionKeyword = ExcelUtils.getCellData(irow, 3);
execute_Actions();
}
}
public static void execute_Actions() {
try {
ActionKeywords actionKeywords = new ActionKeywords();
method = actionKeywords.getClass().getMethods();
// System.out.println(method);
for (int i = 0; i < method.length; i++) {
if (method[i].getName().equalsIgnoreCase(sActionKeyword)) {
// method[i].invoke(actionKeywords,param );
method[i].invoke(actionKeywords);
// System.out.println("Im in for loop");
break;
}
}
} catch (InvocationTargetException e) {
e.getCause().printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}
异常的堆栈跟踪
java.lang.IllegalArgumentException: wrong number of arguments
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 ExcecutionEngine.DriverScript.execute_Actions(DriverScript.java:81)
at ExcecutionEngine.DriverScript.main(DriverScript.java:65)
参数的数量是否错误?您应该阅读指南
java.lang.IllegalArgumentException: wrong number of arguments
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 ExcecutionEngine.DriverScript.execute_Actions(DriverScript.java:81)
at ExcecutionEngine.DriverScript.main(DriverScript.java:65)