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?
To find the list element which is under many levels
To find the list element which is under many levels
You do not have the required permissions to view the files attached to this post.
Last edited by mayur006 on Fri Aug 18, 2017 7:54 am, edited 1 time in total.
Re: To find the list element which is under many levels
Hi,
Please upload a Ranorex snapshot (not screenshot) of the list in question (or at least sample HTML code). This would help us better understand your problem and make the process of creating relevant sample code much easier. Thanks.
Please upload a Ranorex snapshot (not screenshot) of the list in question (or at least sample HTML code). This would help us better understand your problem and make the process of creating relevant sample code much easier. Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: To find the list element which is under many levels
Hi Odklizec,
Please see the uploaded snapshot
Please see the uploaded snapshot
Re: To find the list element which is under many levels
Hi Odklizec,
Could you please provide any suggestion as how to move ahead with the issue?...As I am still unable to figure out any solution
Could you please provide any suggestion as how to move ahead with the issue?...As I am still unable to figure out any solution
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: To find the list element which is under many levels
Hello mayur006,
I'm not sure if I understand your question correctly. I can see in your snapshot file that the LiTag doesn't have an InnerText value. The text, for example for the list item "Create Node" is the value of the ATag.
You would have to check the ATag value in your loop and go back to the LiTag from there. The RanoreXPath could look like the following:
Bernhard
I'm not sure if I understand your question correctly. I can see in your snapshot file that the LiTag doesn't have an InnerText value. The text, for example for the list item "Create Node" is the value of the ATag.
You would have to check the ATag value in your loop and go back to the LiTag from there. The RanoreXPath could look like the following:
/dom[@domain='rgnserver40']//div[#'vakata-contextmenu']/ul//a[@innertext='Create Node']/..Sincerely,
Bernhard
You do not have the required permissions to view the files attached to this post.