I try to use:
Code: Select all
ranorex.spantag tag;
ArrayList btnArr = new ArrayList();
btnArr.add(tag);
foreach(string button in btnArr)
{
mouse.moveTo(button);
mouse.click(button);
}
Code: Select all
ranorex.spantag tag;
ArrayList btnArr = new ArrayList();
btnArr.add(tag);
foreach(string button in btnArr)
{
mouse.moveTo(button);
mouse.click(button);
}
Code: Select all
ranorex.spantag tag; //Creates a spantag element named tag
ArrayList btnArr = new ArrayList(); //Creates an Array
btnArr.add(tag); //Adds the tag element to the array (although the tag element is empty since you didn't assign anything to it)
foreach(string button in btnArr) //Foreach through the array of item (the empty tag element you added)
{
mouse.moveTo(button);
mouse.click(button);
}
Code: Select all
//First make an iList of all spantags on your screen. NOTE: You need to change the word MYROOT below to the element you want to search from.
IList<Ranorex.spantag> MySpanTags = MYROOT.FindChildren<Ranorex.spantag>();
//Next, foreach through all the spantags
foreach (Ranorex.spantag MySpanTag in MySpanTags)
{
//Do what you want here.
}
Code: Select all
string mid = "path";
string here;
Ranorex.SpanTag btnSp;
Duration timeout = 30000;
while(Host.Local.TryFindSingle(mid, timeout, out btnSp))
{
btnSp.GetPath().ToString();
here = btnSp.ToString();
list.Add(btnSp);
Ranorex.Mouse.MoveTo(btnSp);
//btnSp.Click();
}
What's not working? Can you elaborate?That's not working for some reason.
Why? You don't need to build a path. If you make an iList of elements on your page you can just call the click method for each element.How do you build the absolute path from within here
That would be with the findchildren (that I posted above) or find descendants (same as findchildren but goes deeper).Is there anyway to set a simple string and search throughout the page for that and click?
... I don't understand why javascript has anything to do with finding all the elements you want to find... That is the way that works to find all the elements that are a child or descendant to a root object.The IList is not working. There is javascript preventing full recursion through tags.
Code: Select all
Host.Local.TryFindSingle(portalqaRepository.Instance.Path.GetPath().ToString(), timeout, out openButton);
You can easily get a list of all span tags using an RanoreXPath and the Find method:regex wrote:I finally got a sufficient way of doing this. I did use the finddescendents and the Ilist. It took some time to get the code together.
WebDocument dom = ...; // get the DOM here var allSpanTags = dom.Find<SpanTag>(".//span");
To get the absolute path of a repo item, use the "Info" object for that item:regex wrote:However I want to get the full RXpath when building certain elements
RxPath absolutePath = repo.Instance.AppFolder.ItemInfo.AbsolutePath;Regards,
Code: Select all
TrTag allspan = "/dom[@domain='abc']//tr[@id~'abc_[0-9]']";
Code: Select all
IList<TdTag> inners = allspan.FindDescendants<TdTag>("/td[6]/div[2]");
TrTag allspan = "/dom[@domain='abc']//tr[@id~'^abc.*']"; //OR just: TrTag allspan = "/dom[@domain='abc']//tr[@id~'abc']";if you want to search for all TdTags which are children of the div tag you have to use the following code:
IList<TdTag> inners = allspan.Find<TdTag>(".//td[6]/div[2]/td"); //OR: IList<TdTag> inners = yourDivTag.FindDescendants<TdTag>();for more information about how the find methods work please take a look at out online API: Adapter Class.
Code: Select all
IList<DivTag> inners = allspan2.Find<DivTag>(".//td[6]/div[2]");
Code: Select all
Ranorex.TrTag allspan2 = "/dom[@domain='devvprtweb405']//tr[@id~'^ctl00_ctl00_Content_ContentPlaceHolderMain_ReportGrid_ctl00_ctl04_ctl00_PrelimByMonthReportGrid_ctl00__.*']";
Code: Select all
ctl00_ctl00_Content_ContentPlaceHolderMain_ReportGrid_ctl00_ctl04_ctl00_PrelimByMonthReportGrid_ctl00__0
ctl00_ctl00_Content_ContentPlaceHolderMain_ReportGrid_ctl00_ctl04_ctl00_PrelimByMonthReportGrid_ctl00__1
ctl00_ctl00_Content_ContentPlaceHolderMain_ReportGrid_ctl00_ctl04_ctl00_PrelimByMonthReportGrid_ctl00__2