ComboBox: How to know when you can click on the items of a ComboBox after you opened the DropDown
Hi, I am using TestComplete 12 (Desktop Testing). I want to click on ComboBoxItems inside a DropDown of a ComboBox. I need to know when I can click on those items. First step is to click on the ComboBox and open the DropDown. Now I want to click on the items inside the DropDown (items of the ComboBox). The easiest solution is to wait for the property"HasItems" of the ComboBox to be true. But at this time of my program, "HasItems" is already true because I used this ComboBox previously (Items are already loaded). So I can't use this property to know when I can click on the items. I tried to wait for the property "IsDropDownOpen" to be true before clicking.Howeverit seems this property is true before the DropDown is completely opened. The result is: TC12 is too fast and doesn't find the item I am looking for because the DropDown is not completely opened. Do you have any solution for this issue ? I am just trying to wait for a property of the ComboBox to be sure when I can click on the items inside the DropDown (I can't usedirectly the ComboBoxItem that I am looking for). Thanks for your help.2KViews0likes6CommentsUsing .ClickItem() to set dropdown takes too long, but .value doesn't fire onChange in the browser.
Hello, I've been beating my head against the wall on this one for some time now. I'm trying to use TestComplete to create an set of automated tests that will run nightly to see if anyone "broke the build" for our very large web application. The biggest issue at the moment regards the setting of values for ComboBoxes a.k.a. dropdowns. The preferred way to set the value of one of these is using the ClickItem() method. However, some of our dropdowns contain over 1,000 items and it can take 30 seconds or more to set the value. Here is the function to set the value that I created (the wait loop is to try and handle slow JSON calls.): def SetJsonDropdownClick(fieldHandle, newName, newValue, waitForJson): if (waitForJson): stopTime = GetTickCount() + 20000; while (GetTickCount() < stopTime): if fieldHandle.wItemCount >= 2: fieldHandle.ClickItem(newName) if fieldHandle.value == newValue: break aqUtils.Delay(100) else: fieldHandle.ClickItem(newName) However, I found that assigning the value property can set the value property with sub-second response time. def SetJsonDropdownUd(fieldHandle, newValue, waitForJson, triggerJson): i = 0 if (waitForJson): stopTime = GetTickCount() + 20000; while (GetTickCount() < stopTime): if fieldHandle.wItemCount >= 2: fieldHandle.value = newValue if fieldHandle.value == newValue: break i += 1 Log.Message("Pass: " + str(i) + " Count: " + str(fieldHandle.wItemCount) + " Values [" + fieldHandle.value + "]/[" + newValue + "]") Log.Message(fieldHandle.innerHTML) aqUtils.Delay(100) Aliases.browser.Refresh() else: fieldHandle.value = newValue While this cuts the setting time to a consistent sub-second response, it does not raise the OnChange event that triggers JSON calls to fill other dropdowns on the page. I have confirmed by looking at similar issues on this site that this is normal behavior for setting a value that way. I even added the following to the end to get OnChange to fire. if (triggerJson): fieldHandle.Keys("[Up][Down]") While this reliably fires OnChange, it actually does it twice. And sometimes, the first one takes longer than the second (desired) one and the wrong data fills the next dropdown(s) and causes the test script to fail. The following may be marginally faster: def SetJsonDropdownItemList(fieldHandle, newName, newValue, waitForJson): if (waitForJson): stopTime = GetTickCount() + 20000; while (GetTickCount() < stopTime): i = -1 if fieldHandle.wItemCount >= 2: itemListWork = fieldHandle.wItemList.split(';') for i in range(len(itemListWork)): if (itemListWork[i] == newName): fieldHandle.ClickItem(i) break if (i >= 0 & i < len(itemListWork)): break else: aqUtils.Delay(100) else: itemListWork = fieldHandle.wItemList.split(';') for i in range(len(itemListWork)): if (itemListWork[i] == newName): fieldHandle.ClickItem(i) break It still takes time due to the manual search. Since nearly all our dropdowns are sorted alphanumerically, I can implement a binary search. But, still, this and the text based ClickItem take 50% longer than setting the value. I also spent a good amount of time looking at https://community.smartbear.com/t5/TestComplete-Desktop-Testing/ClickItem-Very-Slow-For-DropDown-ComboBox/m-p/136051#M8569 While we have the same symptom, our dropdown list items are children of the dropdown itself. And, the slow selection happens whether the dropdown is filled at page creation or set up later with a JSON call. So, I either need a way to speed up ClickItem() or to trigger the fields OnChange event when setting the value. And, I know that the RaiseEvent function does not handle HTML objects. We are using Python as the scripting language and the TC version is 14.30.Solved1.8KViews0likes5CommentsNot able to retrieve selected DropDown value
Hi, In my windows desktop application,I have many drop downs. TestComplete identifies them as Object Type 'DropDown'. Hence I am not abe to use any methods or properties like wText, Text, SelectedItem, ClickItem,... This Object does not return any methods or properties. From Project > Object Mapping, I tried to add a New Class by selecting this Object from screen, but it cannot be done as it does not belong to ListBox or ComboBox or ListView. I've looked at previous threads and help files and have tried all those suggestions,but am not able to get it done. Any suggestions or help will be much appreciated. These are some settings screens in my application, so the dropdown values are previously selected. When I go to that screen, I just need to read whatever value has been set in that particular drop down field, so as to validate that the rigt value has been set. This is a Power Builder application andI am creating Keyword Tests and scripts using VBScript. Thanks Deepa1.8KViews0likes4Comments