Listitem.Select vs. ListItem.Click : Automation API

Listitem.Select vs. ListItem.Click

Class library usage, coding and language questions.

Listitem.Select vs. ListItem.Click

Postby artur_gadomski » Wed Sep 08, 2010 8: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
artur_gadomski
 
Posts: 125
Joined: Mon Jul 19, 2010 7:55 am
Location: Copenhagen, Denmark

Re: Listitem.Select vs. ListItem.Click

Postby Support Team » Wed Sep 08, 2010 12:59 pm

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
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: Listitem.Select vs. ListItem.Click

Postby artur_gadomski » Thu Sep 09, 2010 7:40 am

I attach a snapshot of a not working and working combo box.
NotWorking.rxsnp
(4.75 KiB) Downloaded 31 times

Working.rxsnp
(4.83 KiB) Downloaded 33 times
User avatar
artur_gadomski
 
Posts: 125
Joined: Mon Jul 19, 2010 7:55 am
Location: Copenhagen, Denmark

Re: Listitem.Select vs. ListItem.Click

Postby Support Team » Thu Sep 09, 2010 12:49 pm

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
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: Listitem.Select vs. ListItem.Click

Postby Ciege » Thu Sep 09, 2010 5: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
Ciege
 
Posts: 965
Joined: Thu Oct 16, 2008 7:46 pm
Location: Arizona, USA

Re: Listitem.Select vs. ListItem.Click

Postby artur_gadomski » Tue Oct 05, 2010 7: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[i].Select();

This seems to work. First click opens up a comboBox then select selects a list item and closes comboBox.
User avatar
artur_gadomski
 
Posts: 125
Joined: Mon Jul 19, 2010 7:55 am
Location: Copenhagen, Denmark


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests