Select an "OptionTag" on SelectTag

Bug reports.
sundarpn
Posts: 17
Joined: Wed Mar 17, 2010 7:36 pm

Select an "OptionTag" on SelectTag

Post by sundarpn » Tue Nov 09, 2010 5:44 pm

I have a web page dialog and in there is a Select Drop down called "Encounter Type". I want to select a specific encounter type. (note that some options might be hidden and a scroll bar might appear).

I have attached the snapshot of the "Encounter Selector" Dialog
EncounterSelector.rxsnp
Encounter Selector snapshot
(571.63 KiB) Downloaded 202 times
Screen shot of application showing this drop-down.
SelectTag.JPG
Select Dropdown & spy seeing it.
SelectTag.JPG (174.69 KiB) Viewed 1304 times
My Repository.
Repo.JPG
Repository
Repo.JPG (83.21 KiB) Viewed 1304 times
.

Code: I want to select the encounter type of "other"
...
...
Repo.WebDocumentEncounter_Selector.SelectTagSelEncounterType
.RMouseClick(message: "Mouse clicked 'Encounter Type' dropdown", delay: 250); //Mouse click to open the dropdown.

OptionTag tag = Repo.WebDocumentEncounter_Selector.SelectTagSelEncounterType.FindSingle("./option[@innertext='Other']");
m_Logger.ReportInfo("----------> " + tag.Visible.ToString());
tag.EnsureVisible(); // I am using ensure visible with the hope that it will scroll the list if the option is not in the visible area.
m_Logger.ReportInfo("----------> After Ensure Visible " + tag.Visible.ToString());

//Issue #1
tag.PerformClick(); //Weird issue. This select the option "CDA" eventhough tag show inner text of "Other"??

//Other options I tried...:
//tag["selected"] = "selected"; //Again selected "CDA". Weird?

Issue #2
//tag.Selected = true; // this selected "Other" however the "OK" button on the dialog is not getting enabled. i.e. App is not seeing the selection.

So:
1. I need to know why Issue #1 is selecting "CDA" when 'tag' option object is for "Other"? This is a bug.
2. What options do I have for issue #2.

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Select an "OptionTag" on SelectTag

Post by Ciege » Tue Nov 09, 2010 6:55 pm

Have a look at this thread that should help you out with your questions:
http://www.ranorex.com/forum/html-select-box-t1714.html
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

sundarpn
Posts: 17
Joined: Wed Mar 17, 2010 7:36 pm

Re: Select an "OptionTag" on SelectTag

Post by sundarpn » Tue Nov 09, 2010 8:11 pm

yes, we actually tried that approach of dropping the select box down and then finding the "Listitem". That works fine except in the case when the list item is not visible. If the item is not visible, it throws an element not found exception.

Screen shot:
SelectDropDownScrollbar.JPG
SelectDropDownScrollbar.JPG (44.67 KiB) Viewed 1298 times

So I added the scroll bar and did a simple while loop like this...

//...Select drop down is already open via click

Code: Select all

ListItem item = null;
System.DateTime start = System.DateTime.Now;

while (!Repo.ContainerSelectbox.Self.TryFindSingle("./listitem[@text='" + encounterType + "' and @visible='true']", 3000, out item))
{
        if( (System.DateTime.Now - start).TotalSeconds > m_WaitCheckTimeoutSecs)
               throw new EEHREnsureVisibleFailureException("Encounter Selector ->Encounter Type: " + encounterType + " failed to become visible.");

        Repo.ContainerSelectbox.btnLine_down.Click();
        m_Logger.ReportInfo("Clicked Line Down");

}

  //item.Select(); //dind't work. have to use mouse click

item.RMouseClick(message: "Mouse clicked '" + encounterType + "' on 'Encounter Type' dropdown", delay: 250);

m_Logger.ReportStep("Selected '" + encounterType + "' on 'Encounter Type' dropdown");

NOTE: the screen shot above is from my actual run when scroll down btn was pressed like 5 times and you can see the item "other" is indeed visible... But ranorex still did not find it and threw my exception with this message "Encounter Selector ->Encounter Type: Other failed to become visible."

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Select an "OptionTag" on SelectTag

Post by Ciege » Tue Nov 09, 2010 8:28 pm

Try increasing your findsingle timeout from 3000 to 30000. You could be timing out before Ranorex gets a chance to actually search for and find the item.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

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

Re: Select an "OptionTag" on SelectTag

Post by Support Team » Wed Nov 10, 2010 11:42 am

Hi,

Please could you post us a Ranorex snapshot of the container in your use case above?
To track the container of the select-box you have to use Instant Tracking of Spy and then save it as snapshot.
Instant Tracking
Create a Snapshot

Thanks in advance.

Regards,
Peter
Ranorex Team
.
Image

sundarpn
Posts: 17
Joined: Wed Mar 17, 2010 7:36 pm

Re: Select an "OptionTag" on SelectTag

Post by sundarpn » Wed Nov 10, 2010 4:58 pm

Hello,

I have captured the snapshot of the container that drops down showing the list items. (using instant tracking)
Container_DropDown.rxsnp
Container Snapshot
(459 Bytes) Downloaded 199 times
Another Screenshot showing this dropdown.
pic_Encounter_Type_Dropdown.JPG
pic_Encounter_Type_Dropdown.JPG (73.05 KiB) Viewed 1287 times
My post above also has the code snippet and the associated repository we use.

sundarpn
Posts: 17
Joined: Wed Mar 17, 2010 7:36 pm

Re: Select an "OptionTag" on SelectTag

Post by sundarpn » Wed Nov 10, 2010 5:13 pm

Hello,

For some reason, the snapshot of the Container I attached isn't complete. The size is only 1 KB and is NOT capturing the list items shown. I tried again and the result is the same...

See this screen shot.
screen_shot.JPG
screen_shot.JPG (156.41 KiB) Viewed 1285 times

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

Re: Select an "OptionTag" on SelectTag

Post by Support Team » Thu Nov 11, 2010 11:32 am

Hi,

I think this is a "msaa" limitation. Instead of posting us the Ranorex Snapshot, would it be possible to post us a screenshot where you instant track the combo box and we can also see the spy on this screenshot. Are the list items always invisible or only if you have to scroll to one list item inside the combo box. See Ranorex Spy all elements even, when you have to scroll to elements? (some elements should have the state "visible" and some have the "invisible" state)

Thanks in advance.

Regards,
Peter
Ranorex Team
.
Image

sundarpn
Posts: 17
Joined: Wed Mar 17, 2010 7:36 pm

Re: Select an "OptionTag" on SelectTag

Post by sundarpn » Thu Nov 11, 2010 10:22 pm

When we run the scripts with our own suiterunner via Teamcity on an agent m/c, for some reason that drop-down shows a scroll-bar within it. (You can see this in the screen shot on second post in this thread dated Tue Nov 09, 2010 2:11 pm)

But the last two screen shot I posted was from my local desktop in which I don't see the scroll bar. I tried reducing the resolution of my desktop down to 800 by 600 and even then the scroll bar wouldn't appear.

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

Re: Select an "OptionTag" on SelectTag

Post by Support Team » Mon Nov 15, 2010 11:20 am

Hi,

Maybe the different skin of you operating system, forces your application to paint the combo box in a different way. Have you tried to use the same setting from the computer with the "combo box scrollable" on your computer. Another possibility could be the Internet Explorer. Maybe on your computer is 8.0 installed and on the other machine 7.0.

Regards,
Peter
Ranorex Team
.
Image