public void ListArticles(Ranorex.Adapter postsContainer) { var element = postsContainer.GetPath().ToString(); postsContainer.EnsureVisible(); //IList<Ranorex.ArticleTag> IArticles = postsContainer.As<Ranorex.DivTag>().FindDescendants<Ranorex.ArticleTag>(); IList <Ranorex.ArticleTag> IArticles = Host.Local.Find <Ranorex.ArticleTag>(element + "//article", 5000); Ranorex.Report.Log(ReportLevel.Info, "There are " + IArticles.Count + " on this page"); // Collect article headers foreach (Ranorex.ArticleTag articles in IArticles) { string articleheader = articles.FindDescendant <Ranorex.ATag>().InnerText; Ranorex.Report.Info("article", articleheader); } }
public void CaptureArticles(Ranorex.Adapter postsContainer) { //Get the RXPath of the passed OR element var element = postsContainer.GetPath().ToString(); int x = 1; //Incremented at the end of the following do loop. If x>1 clcik Next int rowcount = 1; //Keeps tract of rows to be written to Excel. Start at 1. //Loop to capture articles do { //For first do loop iteration x=1, so we will not click "Next" if (x > 1) { repo.EdgewordsTrainingAutomatedSoftware.Next.Click(); repo.EdgewordsTrainingAutomatedSoftware.Self.WaitForDocumentLoaded(); } postsContainer.EnsureVisible(); //IList<Ranorex.ArticleTag> IArticles = postsContainer.As<Ranorex.DivTag>().FindDescendants<Ranorex.ArticleTag>(); //Generate list of articles inside passed OR item. The above approach failed (presumably the element becomes //stale after navigating to the next set of results IList <Ranorex.ArticleTag> IArticles = Host.Local.Find <Ranorex.ArticleTag>(element + "//article", 5000); Ranorex.Report.Log(ReportLevel.Info, "There are " + IArticles.Count + " on this page"); // Collect article headers foreach (Ranorex.ArticleTag articles in IArticles) { string articleheader = articles.FindDescendant <Ranorex.ATag>().InnerText; Ranorex.Report.Info("article", articleheader); writedata(articleheader, rowcount); //Call helper method to write to Excel rowcount++; } x++; //Increment X so on next loop the "Next" button is clicked }while(repo.EdgewordsTrainingAutomatedSoftware.NextInfo.Exists(3000)); // Only loop if there is a "Next" button }