public int getEmailCountFromSelectedFolder(Ranorex.Adapter item) { //IList<Ranorex.Unknown> elements=item.Find<Ranorex.Unknown>("/element[@classname='LeafRow']"); IList <Ranorex.Unknown> elements = item.FindChildren <Ranorex.Unknown>(); Report.Info(elements.Count.ToString()); return(elements.Count); }
public string MultiSelectEmail(Ranorex.Adapter item, int mailCount, bool getValues = false) { int l = 0; string mailsubject = ""; string txt = ""; int indx1, indx2 = 0; string txt2 = ""; IList <Ranorex.Container> containers = item.FindChildren <Ranorex.Container>(); for (int i = 0; i < mailCount; i++) { if (l >= mailCount) { break; } for (int j = 1; j < containers.Count; j++) { //containers[2].Click(); Delay.Seconds(1); Report.Info(containers[j].GetAttributeValue <String>("Name")); IList <Ranorex.Unknown> elements = containers[j].FindChildren <Ranorex.Unknown>(); for (int k = 0; k < elements.Count; k++) { if (l >= mailCount) { break; } elements[k].Focus(); elements[k].Click(); Keyboard.Press("{LControlKey down}"); if (getValues == true) { txt = elements[k].Element.GetAttributeValueText("Name"); indx1 = txt.IndexOf("Subject ") + 8; indx2 = txt.IndexOf(", Received"); txt2 = txt.Substring(indx1, indx2 - indx1); if (txt2.Length > 10) { txt2 = txt2.Substring(0, 10); } mailsubject += txt2 + "~"; } l++; } if (l >= mailCount) { break; } } } Keyboard.Press("{LControlKey up}"); if (getValues == true) { return(mailsubject); } else { return(null); } }