Our web application has a nav bar and I am trying to create a Generic Button Navigation class, which would allow for a variable to decide which button is pressed from any document (as this nav bar appears in most screens).
I think I know how to do this
To get the button
Code: Select all
public static Ranorex.WebElement getEle(string path, int timeout){
Element ele = null;
Host.Local.TryFindSingle(path, timeout, out ele);
try{WebElement we = new WebElement(ele);return we;}
catch{
if(path.Equals("path")) {
Report.Log(ReportLevel.Info, "Form not found, waiting for form to load.");
}else{
Report.Log(ReportLevel.Warn, "Not found: "+path);
}
}
Code: Select all
getele(path + BUTTONNAME + restOfPath, timeout).Click()