To find the list element which is under many levels
Posted: Fri Aug 18, 2017 5:33 am
Hi,
I am new to Ranorex and posses very little exposure to code.
I wanted to execute a scenario where in a context menu there are multiple list tag(li) element in unordered list(ul) with each li containing the another ul having list of li and so on (upto 4 levels).
Ul1
<li>Abc<li>------Ul2
<li>123<li>-------------ul3
<li>mns<li>----------ul4
<li>890<li>
I want to get the particular li element by its name and then subsequent elements under that . However my problem is that the search should be from the top for number of elements , cause otherwise it looses focus from the particular unordered list.
I tried using below code but it seems only work with id and not by name.
IList<Ranorex.LiTag> TestCodeTemplateListItems = Host.Local.Find<Ranorex.LiTag>("/dom[@domain='xyz']//div[#'vakata-contextmenu']/ul/li[1]/ul/./li");
foreach (Ranorex.LiTag TestCodeTemplateListItem in TestCodeTemplateListItems)
{
TestCodeTemplateListItem.MoveTo();
Ranorex.Report.Screenshot(TestCodeTemplateListItem);
}
}......for 1st ul list
IList<Ranorex.LiTag> Opertional_1st_item_under_operational_listListItems = Host.Local.Find<Ranorex.LiTag>("/dom[@domain='xyz']//div[#'vakata-contextmenu']/ul/li[1]/ul/li[7]/ul/./li");
foreach (Ranorex.LiTag Opertional_1st_item_under_operational_listListItem in Opertional_1st_item_under_operational_listListItems)
{
Opertional_1st_item_under_operational_listListItem.MoveTo();
Ranorex.Report.Screenshot(Opertional_1st_item_under_operational_listListItem);
could you please help me achieve this?
I am new to Ranorex and posses very little exposure to code.
I wanted to execute a scenario where in a context menu there are multiple list tag(li) element in unordered list(ul) with each li containing the another ul having list of li and so on (upto 4 levels).
Ul1
<li>Abc<li>------Ul2
<li>123<li>-------------ul3
<li>mns<li>----------ul4
<li>890<li>
I want to get the particular li element by its name and then subsequent elements under that . However my problem is that the search should be from the top for number of elements , cause otherwise it looses focus from the particular unordered list.
I tried using below code but it seems only work with id and not by name.
IList<Ranorex.LiTag> TestCodeTemplateListItems = Host.Local.Find<Ranorex.LiTag>("/dom[@domain='xyz']//div[#'vakata-contextmenu']/ul/li[1]/ul/./li");
foreach (Ranorex.LiTag TestCodeTemplateListItem in TestCodeTemplateListItems)
{
TestCodeTemplateListItem.MoveTo();
Ranorex.Report.Screenshot(TestCodeTemplateListItem);
}
}......for 1st ul list
IList<Ranorex.LiTag> Opertional_1st_item_under_operational_listListItems = Host.Local.Find<Ranorex.LiTag>("/dom[@domain='xyz']//div[#'vakata-contextmenu']/ul/li[1]/ul/li[7]/ul/./li");
foreach (Ranorex.LiTag Opertional_1st_item_under_operational_listListItem in Opertional_1st_item_under_operational_listListItems)
{
Opertional_1st_item_under_operational_listListItem.MoveTo();
Ranorex.Report.Screenshot(Opertional_1st_item_under_operational_listListItem);
could you please help me achieve this?