RFT get .text value from Html.SELECT and compare with a reg exp -
i need identify html.select object application , select it. succesfull in doing that, cannot write entire .text string in code long list of locations. how can pull value , compare regular expression. example - .text district................................................
and want have string variable district.* in below code need string name regular expression
selectmcasdistrict("district.*"); public static void selectmcasdistrict(string name) { guitestobject textobj = findtextobjectdist(name); if (textobj != null) { ((selectguisubitemtestobject) textobj).select("abington.*"); } else { throw new objectnotfoundexception(); } } private static guitestobject findtextobjectdist(string name) { testobject[] tobs = find(atdescendant(".class", "html.select", ".text", name ), true); if(tobs.length == 0) return null; return (guitestobject)tobs[0]; }
what asking possible. instead of giving find method search conditions in string format, can use property class, stated here.
this way, code became:
private static guitestobject findtextobjectdist(string name) { // build searching filters property[] props = new property[2]; props[0] = new property(".class", "html.select"); props[1] = new property(".text", new regularexpression("district.*", false)); // search objects testobject[] tobs = find(atdescendant(props), true); // return them if(tobs.length == 0) return null; return (guitestobject)tobs[0]; }
Comments
Post a Comment