Page 1 of 1

How to handle Multi selected Dropdown...?

Posted: Thu Feb 19, 2015 2:54 pm
by nandhu
I used presskeys property for selecting the values... pls go through Dropdown.JPEG file
For exmple:Presskey("EST");presskeys("{enter}");
This will get the value starting with EST word and it populates the vaue to the field...
After selecting the values the field looks like ... pls go through afterselecting.JPEG file
As press keys is not working i used view spy and written the whole path and clicked it...
LiTag media="/dom//ul[#'media_listbox']/li[@innertext='Pay TV']";
media.Click();
But all the time we cant give the whole path in the code as others want to give other values to the field...
so please help me out how to dynamically select the values and how to delete if we don't want that particular value.....I think its a kendo control

Re: How to handle Multi selected Dropdown...?

Posted: Fri Feb 20, 2015 10:18 am
by Support Team
Hello nandhu,

In order to make your “LiTag” dynamically accessible you will need to use a variable for its “innertext”-property. Please find a detailed instruction on how to use variables in our User Guide.

Hope this information helps.

Regards,
Robert

Re: How to handle Multi selected Dropdown...?

Posted: Mon Feb 23, 2015 6:15 am
by nandhu
Is there any other way as we got the path through spy.... its nt working so pls let me knw hw 2 do it

Re: How to handle Multi selected Dropdown...?

Posted: Tue Feb 24, 2015 5:17 pm
by Support Team
Hi nandhu,

As you wrote in your first post the RxPath works but not for all elements since it references a specific LiTag.
When you want to address different LiTags with one RxPath you need to use a variable to address the different elements in your dropdown.
Please let me know in case I got something wrong here.

Regards,
Markus

Re: How to handle Multi selected Dropdown...?

Posted: Thu Feb 26, 2015 6:20 am
by nandhu
I need to give a value in the input tag and when we type a value we can see a dropdown with some values starting with the 3letters of the value.... u can see the input tag in spy1 attachment....
And you can see the path of the divtag containing litag and pls go through the divtag pic...
For example if we give Epic in the input tag,a dropdown will appear and the Epic element should be selected from the list....
I used Presskeys method but its not working for us as after giving the value,enter should be given bt when we use enter with presskeys method someother button is getting clicked... as the funtionalty is like dat....so we cannot use presskeys method also...
I used some other funtion like.....
obj.simpleTitleSearch("Report","Epic",".//div[@id='id-simple-title-list']");

public bool simpleTitleSearch(string RootedFolder,string TitleName,string ObjPath)
{
bool result = true;
string functionName = "simpleTitleSearch";
string functionStatus = "";
try{
PB pbrx = new PB(repo, "XXXX", RootedFolder, "");
if(pbrx != null)
{
pbrx.pbclkButton("simpleSearchBtn");
pbrx.pbsetTextboxPressKeys("simpleSearchTitleInput",TitleName);
}
Delay.Milliseconds(10000);
WebDocument webDocument = "/dom";
DivTag topMenuDiv = webDocument.FindSingle(ObjPath);
topMenuDiv.EnsureVisible();
foreach (LiTag item in topMenuDiv.Find(".//li[@visible='true']"))
{
Mouse.MoveTo(item);
foreach (LiTag subitem in item.Find(".//li[@visible='true']"))
{

Mouse.MoveTo(subitem);
item.Click();
break;
}
break;

}
}
catch(Exception ex){
result = false;
}
return result;

}


But when I used this funtion I am getting the value to the input tag from the dropdown but it is selecting the starting value in the dropdown list which is not correct value...
So,this is the problem am facing so pls go through it

Re: How to handle Multi selected Dropdown...?

Posted: Tue Mar 03, 2015 6:08 pm
by Support Team
Hi nandhu,

There are unfortunately many small "errors" as well as some logical errors in your code.
To get more information about the different Ranorex methods I would recommend to take a look at our Ranorex API as well as on the following code examples: Code Examples.
I would therefore also ask you to discuss this issue via email?
If this is okay for you, please send an email with the link to this post to [email protected].

Thanks,
Markus