Hi
I am new to the forum and using Ranorex. I am trying to select the innerText on a child DivTag and need some help to do so, using the User Code. Can anyone one you help me. Attached is an image of the test case I am working on.
how to select a child DivTag from a parent?
how to select a child DivTag from a parent?
You do not have the required permissions to view the files attached to this post.
Re: how to select a child DivTag from a parent?
Hi,
Please upload a Ranorex snapshot (NOT screenshot) of the problematic menu. Screenshot is unfortunately useless as nobody here probably wants to retype xpaths from screenshot. The things are much easier to understand and explain with snapshots!
Additionally, please describe what exactly do you want to achieve? It's not quite clear to me what's your workflow and goal?
Please upload a Ranorex snapshot (NOT screenshot) of the problematic menu. Screenshot is unfortunately useless as nobody here probably wants to retype xpaths from screenshot. The things are much easier to understand and explain with snapshots!
Additionally, please describe what exactly do you want to achieve? It's not quite clear to me what's your workflow and goal?
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: how to select a child DivTag from a parent?
public void SelectMenuItem(string ItemtoSelect, RepoItemInfo MenuItemInfo)
{
WebDocument webDoc = "/dom[@domain='"+ SelDom +"']";
var dropdown = webDoc.FindSingle<UlTag>(".//iframe[@name='main']//div[#'ctl00_phDS_ds_ToolBar_menu13']/ul");
var options = dropdown.FindDescendants<DivTag>();
var found = false;
foreach(var opt in options)
{
if(opt.InnerText == ItemtoSelect)
{
opt.Click();
found = true;
break;
}
}
if(found == false)
{
throw new InvalidOperationException("Select Menu Item option not found for ");
}
}
{
WebDocument webDoc = "/dom[@domain='"+ SelDom +"']";
var dropdown = webDoc.FindSingle<UlTag>(".//iframe[@name='main']//div[#'ctl00_phDS_ds_ToolBar_menu13']/ul");
var options = dropdown.FindDescendants<DivTag>();
var found = false;
foreach(var opt in options)
{
if(opt.InnerText == ItemtoSelect)
{
opt.Click();
found = true;
break;
}
}
if(found == false)
{
throw new InvalidOperationException("Select Menu Item option not found for ");
}
}