Listitem.Select vs. ListItem.Click

Class library usage, coding and language questions.
User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Listitem.Select vs. ListItem.Click

Post by artur_gadomski » Wed Sep 08, 2010 7:08 am

Hi
I am automating a couple of MFC ComboBoxes. What I did was:
Ranorex.ComboBox c = _path;
c.Items[_index].Select();
_name = c.SelectedItemText;
And that works fine for all but one ComboBox. This particular ComboBox doesn't seem to be any different but it exhibits a particular behavior. When automating I choose a value from ComboBox, close a dialog and open it again to check if it's the same. This works when I use mouse(either through automation or manually), but fails when using select method.
I want to talk with developers and have them figure out why this particular control behaves differently but for that I would like to know what is the difference between using select method and actually expanding combo box and clicking on an item?

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

Re: Listitem.Select vs. ListItem.Click

Post by Support Team » Wed Sep 08, 2010 11:59 am

Hi,
artur_gadomski wrote:what is the difference between using select method and actually expanding combo box and clicking on an item?
The difference between Select() and Click() method of a list item is, that the Select() method only selects the item without any mouse movements (User interactions). The Click() method instead uses the mouse to click on the item as a "real" user would it do.

Would it also be possible to send us a Ranorex Snapshot of the corresponding combo box? Maybe we can find an issue why there is a difference.

How to create a Ranorex Snapshot
http://www.ranorex.com/support/user-gui ... html#c2072

Regards,
Peter
Ranorex Team
.
Image

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: Listitem.Select vs. ListItem.Click

Post by artur_gadomski » Thu Sep 09, 2010 6:40 am

I attach a snapshot of a not working and working combo box.
NotWorking.rxsnp
(4.75 KiB) Downloaded 176 times
Working.rxsnp
(4.83 KiB) Downloaded 179 times

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

Re: Listitem.Select vs. ListItem.Click

Post by Support Team » Thu Sep 09, 2010 11:49 am

I looked to your snapshots of the combo-boxes and I cannot find any difference. Maybe your developers implement the "not working" combo-box in a different way. This could be one possible cause why it is not working.

Regards,
Peter
Ranorex Team
.
Image

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

Re: Listitem.Select vs. ListItem.Click

Post by Ciege » Thu Sep 09, 2010 4:33 pm

Is it possible that your dev team has implemented an onclick method on the "non working" combo box? Maybe on click (i.e. using the mouse) causes something to be set in the back end, that could be why the combo box is not as you expect it to be when you go back to it.

Using the select method in automation would not trigger the onclick to occur so anything that may be set by that onclick method would never happen.
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
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: Listitem.Select vs. ListItem.Click

Post by artur_gadomski » Tue Oct 05, 2010 6:48 am

Developers said that there is no reason why one Combo Box should work and another not.
The same problem came up yesterday and I managed to find a workaround.
comboBox.Click();
comboBox.Items.Select();

This seems to work. First click opens up a comboBox then select selects a list item and closes comboBox.