public static <T> T getControl(ScriptHelper app, String widgetID, Class<T> cls)throws Throwable{ String controlName = ParseFile.getParseInfo(widgetID).get("Name"); // 获取TestClass的Class对象 Class tClass = Class.forName(cls.getName()); T control = null; Constructor con = null; con = tClass.getConstructor(WindowExt.class, IFindRule.class, String.class ); control = (T) con.newInstance(new Object[] { BodyFrameFacotry.getBodyFrame(app, widgetID), FindRuleFactory.byProperties(ParseFile.getWidgetPro()), controlName }); return control; }