Probelm with drop down "Select" control in Web

Ask general questions here.
sunilDahiya
Posts: 11
Joined: Tue Jul 31, 2012 2:21 pm

Probelm with drop down "Select" control in Web

Post by sunilDahiya » Mon Sep 24, 2012 4:48 pm

Hi Team,

I am working with Microsoft Dynamics CRM web application. I have problem while saving the items from a drop down "select" control.
The detailed problem is followed:
scenario: Manuel
1. when I select an item from Drop down and save the information, the item is saved and listed & displayed also in drop down.

scenario: automation
2. I can select the item from the drop down. after clicking the save button, the item is not displayed & listed in drop down. Drop down returns to 0 index where there is no item selected.


Could anyone know, what can be cause for it. I even can not see if there is any server side event happening in between these steps.

Thanks for your answer.

Sunil

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

Re: Probelm with drop down "Select" control in Web

Post by Ciege » Mon Sep 24, 2012 5:13 pm

Can you share your code for what you are doing so we have a better idea to help with...

Are you actually performing a click action in your code or are you just setting the value of the drop list then clicking save?
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...

sunilDahiya
Posts: 11
Joined: Tue Jul 31, 2012 2:21 pm

Re: Probelm with drop down "Select" control in Web

Post by sunilDahiya » Tue Sep 25, 2012 8:37 am

Hi Team,

basically I tried three ways ;)
1. set the value of the item as "selected = true";
2. set the value of the item as true and then click on the item.
2. Click on the item.

and finally save on click.
a bit of code is here:
Adapter currentAdapter = id.toGuiItemUsingReflection(); //I am getting my Adapter Control
if(null == currentAdapter) return id.findGuiItemByIdAtFault();

//Click on the Drop down menu -->Select control
currentAdapter.EnsureVisible();
currentAdapter.Click(Location.CenterRight); //

//Getting all the child elements of the drop down(select control)
IEnumerable<OptionTag> listItems = (object)currentAdapter.GetPropertyValueByReflection("Options") as IEnumerable<OptionTag>;
if(listItems != null)
{
var list = listItems.Where(item => item.Title == expectedListItem).First();
if(list != null){
//1.Method, i tried to set the value as true
list.Selected = true;
// 2. method, i tried to set the value as true and click
list.selected = true;
list.Click();
// 3. method, i tried to just click on item
list.Click();
}
}

but after that, when I click on save, the selected item from drop down does not remain as selected. Drop down sets back to null.

Thanks for your help.

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

Re: Probelm with drop down "Select" control in Web

Post by artur_gadomski » Tue Sep 25, 2012 9:26 am

Try to press Tab after selecting/clicking. Sometimes removing focus from control triggers events that don't get triggered otherwise.

sunilDahiya
Posts: 11
Joined: Tue Jul 31, 2012 2:21 pm

Re: Probelm with drop down "Select" control in Web

Post by sunilDahiya » Tue Sep 25, 2012 11:14 am

Hi Team,

press "Tab" does not helped here. I think it is a problem of some event triggering.
The Click function does not trigger any event while selecting the item during automation.

additionally, i can't also find out what event is triggered when an item is selected from the "Select Tag" element, when I select the item manually.

again help is needed :)

any solution?

Thanks

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Probelm with drop down "Select" control in Web

Post by Support Team » Tue Sep 25, 2012 3:08 pm

Hi,

Could you post a Ranorex snapshot file of that element?
Following link will show you how to generate a snapshot file:
Creating Ranorex Snapshot Files.

Thanks,
Markus
Ranorex Support Team

User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Probelm with drop down "Select" control in Web

Post by Aracknid » Tue Oct 16, 2012 3:03 pm

I can tell you from my own experience that select controls are a pain (just wait until you start using all browser types...).

If your control has an event that gets fired on the selection (that is when you manually click on it), it will not get fired if you use "selection=true" in automation. In my web app, I've found that once you use selection=true and the select control is "set", clicking on it or using tab, or any other thing will make no difference.

However, in my app, if I do drop open the select control and click on it, it does work. The problem I was having was getting it to actually click on the right item. So I would suggest you make sure that it is in fact clicking on it. Also, if you walk through a select list and use keyboard keys to move through it and hit enter on the one you want, it will fire the event.

There is a way to fire the even yourself, it was discussed in another post I initially started. Look here and it might help. It's long, but gets to the ExecuteScript stuff at the bottom and on the second page.

http://www.ranorex.com/forum/select-con ... t3596.html

Aracknid