How to handle Multi selected Dropdown...?

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
nandhu
Posts: 12
Joined: Wed Jan 21, 2015 6:59 am

How to handle Multi selected Dropdown...?

Post by nandhu » Thu Feb 19, 2015 2:54 pm

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
Attachments
Afterselectingvalues.jpg
Afterselectingvalues.jpg (3.74 KiB) Viewed 1096 times
Dropdown.jpg
Dropdown.jpg (9.64 KiB) Viewed 1096 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

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

Post by Support Team » Fri Feb 20, 2015 10:18 am

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
.
Image

nandhu
Posts: 12
Joined: Wed Jan 21, 2015 6:59 am

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

Post by nandhu » Mon Feb 23, 2015 6:15 am

Is there any other way as we got the path through spy.... its nt working so pls let me knw hw 2 do it

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

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

Post by Support Team » Tue Feb 24, 2015 5:17 pm

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
.
Image

nandhu
Posts: 12
Joined: Wed Jan 21, 2015 6:59 am

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

Post by nandhu » Thu Feb 26, 2015 6:20 am

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
Attachments
Divtag.jpg
Divtag.jpg (290.73 KiB) Viewed 1047 times
Spy1.jpg
Spy1.jpg (270.24 KiB) Viewed 1047 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

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

Post by Support Team » Tue Mar 03, 2015 6:08 pm

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
.
Image