Not able to select values in SelectTag combobox

Ask general questions here.
NishantSingh
Posts: 39
Joined: Thu Oct 09, 2014 1:15 pm
Location: Bangalore

Not able to select values in SelectTag combobox

Post by NishantSingh » Thu Jan 01, 2015 3:28 pm

Hi,

I am using Ranorex studio 5.2.0, windows 7 OS and Mozilla Firefox 33

On a webpage from a combobox (SelectTag) i have to select a specific value but I am not able to do it.
PFA the snapshot.

please help me out

Regards,
Nishant Singh
Attachments
RanorexSnaps.rxsnp
(153.86 KiB) Downloaded 128 times
Regrads,
Nishant Singh

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

Re: Not able to select values in SelectTag combobox

Post by Support Team » Fri Jan 02, 2015 2:00 pm

Hi Nishan,

May I ask you how you tried to select the specific SelectTag?
By the way, could you also update to the latest Ranorex version, which is Ranorex 5.2.1?
Here is the link: Ranorex 5.2.1.

Thanks,
Markus
.
Image

NishantSingh
Posts: 39
Joined: Thu Oct 09, 2014 1:15 pm
Location: Bangalore

Re: Not able to select values in SelectTag combobox

Post by NishantSingh » Sat Jan 03, 2015 8:44 pm

Hi Markus,

I have tried this piece of code
Ranorex.SelectTag selectCountry = "/dom[@domain='www.amazon.in']//select[#'enterAddressCountryCode']";
selectCountry.Click();
ListItem selectCList = selectCountry.FindSingle<ListItem>("Option[@innertext = '" + strCountry + "']");
selectCList.Click();

but this is not working as the container don't have any List I checked with the Spy.

Again I have tried by modifying this piece of code which I found in your support forum
foreach (OptionTag option in DOMCombo.Find(".//option"))
{
if (option.InnerText == ComboItem)
{
ComboItemFound = true;
break;
}


but these are nit working so Finally I have to use this
RepObj.AmazonSite.EnterAddressCountryCode.Element.SetAttributeValue("TagValue", strCountry);
RepObj.AmazonSite.AddressType.Element.SetAttributeValue("TagValue", strAddressType);

to make it working but it is using the Tag value and I want to use Innertext value to select an option

please let me know if you can help me on this.

Regards,
Nishant Singh
Regrads,
Nishant Singh

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

Re: Not able to select values in SelectTag combobox

Post by Support Team » Mon Jan 05, 2015 10:57 am

Hi Nishan,

The last code is the right one, from what I can see there is just the possibility to change the TagValue of the specific select tag and this is also the recommended way.

Regards,
Markus
.
Image

NishantSingh
Posts: 39
Joined: Thu Oct 09, 2014 1:15 pm
Location: Bangalore

Re: Not able to select values in SelectTag combobox

Post by NishantSingh » Mon Jan 05, 2015 6:35 pm

Hi Markus,

So only using Tag Value I can set the dropdown value and not by using innertext of the dropdown value ?

Ok thanks..


Regards,
Nishant Singh
Regrads,
Nishant Singh

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

Re: Not able to select values in SelectTag combobox

Post by Support Team » Wed Jan 07, 2015 2:32 pm

Hi Nishan,

This always depend on the specific select tag and how it was implemented, but in case of this select tag you need to use the TagValue, right.

Regards,
Markus
.
Image

NishantSingh
Posts: 39
Joined: Thu Oct 09, 2014 1:15 pm
Location: Bangalore

Re: Not able to select values in SelectTag combobox

Post by NishantSingh » Wed Jan 14, 2015 7:23 pm

thanks Markus.

Regards,
Nishant Singh
Regrads,
Nishant Singh