cancel
Showing results for 
Search instead for 
Did you mean: 

ComboBox item selected ok but get an error anyway

SOLVED
Occasional Contributor

ComboBox item selected ok but get an error anyway

I have a test with a ComboBox "ClickItem" operation to select a ComboBox item, with this description: "Selects the 4 item of the 'ComboBox' combo box". The 4th item is always selected correctly, but the operation fails anyway. After selecting the correct ComboBox item, TC says "Waiting for the ComboBox object" and times out. It then says, "The control does not exist", and it logs an error. It can select the correct ComboBox item by integer index or by name, but with the same resulting error.

The Test Visualizer image for this operation shows a blank combo box item instead of the actual item to be selected. Is this why it fails?  If so, how can I tell TC not to care if the Visualizer image doesn't match?  Or basically, how can I stop TC from failing this operation, since it succeeds in selecting the correct ComboBox item?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Hero

Re: ComboBox item selected ok but get an error anyway

You can use Point and Fix in ObjectSpy to get the combo box.  Let's see what that shows.

Occasional Contributor

Re: ComboBox item selected ok but get an error anyway

I solved this issue by using a script function (as suggested by Alex at Smartbear) to call the ComboBox's native method (SelectItemWithValue) instead of the TC method ClickItem that's added when recording the test.  I had trouble finding the ComboBox with ObjectSpy to use as the object path in the script, but I found it using Point and Fix as suggested by Martha (I marked it as the solution, since it was the closest).  That was necessary because the ComboBox only exists while the dropdown is open, and it closes when you click elsewhere, e.g. for the ObjectSpy drag.

 

Alex explained that the TC ClickItem method, which I had used for the ComboBox item selection, first executes the click, then verifies that it went ok.  But the ComboBox disappears in the object tree as soon as the selection is made, so it hangs while trying to verify.

 

 

 

19 REPLIES 19
Community Hero

Re: ComboBox item selected ok but get an error anyway

Have you tried turning off the visualizer to make sure that that is, indeed, the problem?


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Occasional Contributor

Re: ComboBox item selected ok but get an error anyway

I turned off visualizer data collection during recording and test runs, re-recorded the ComboBox test step, and it still fails the same way.  Now at least I understand the visualizer data collection doesn't affect test runs.

Community Hero

Re: ComboBox item selected ok but get an error anyway

Hi,

 

After selecting the correct ComboBox item, TC says "Waiting for the ComboBox object" and times out.

Can you provide the relevant part of code and specify what exactly line of code causes error record in the log? (Either double-click log error in the log or use Stack Trace log pane).

The idea is that the combo-box is recreated after selected item changes and this invalidates the reference to the previous instance test code tries to use.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Occasional Contributor

Re: ComboBox item selected ok but get an error anyway

I attached a snapshot of the KeyWord test steps up to the ClickItem operation.  It shows the object path of the ComboBox.  After the test runs and the operation fails, if I click "Highlight" with the application still running, it says it can't display the object.

Community Hero

Re: ComboBox item selected ok but get an error anyway

The 4th item is always selected correctly, but the operation fails anyway. After selecting the correct ComboBox item, TC says "Waiting for the ComboBox object" and times out. It then says, "The control does not exist", and it logs an error. 

 

How do you know that the 4th item is selected correctly?

Occasional Contributor

Re: ComboBox item selected ok but get an error anyway

When TC executes the ComboBox operation, I can see in the application UI that the 4th menu item "Ethanol" has been correctly selected (see attached image).  But then TC says "Waiting for ComboBox object" and times out and logs the error.  If I could somehow tell TC not to bother waiting for the ComboBox at that point, it would be great.

Occasional Contributor

Re: ComboBox item selected ok but get an error anyway

Sorry, I meant to say "Kerosine", not Ethanol.

Community Hero

Re: ComboBox item selected ok but get an error anyway

Try putting a breakpoint in a few lines up from the one where you get the error.  Run the test in debug mode and when it gets to the breakpoint, execute each line and watch the results.  I'm suspicious that the combo box is getting clicked by one of the other lines in your program and then that in turn is messing up the timing so you get the errors.

 

 

Occasional Contributor

Re: ComboBox item selected ok but get an error anyway

I converted the test to script to use the debugger. I found that only the last line with ComboBox.ClickItem selects the menu item and causes the "Waiting for the ComboBox object" error. With the breakpoint on the last line (see image), it stops before selecting the item and waiting for the object. If I comment out the last line, it doesn't select the menu item or wait for the ComboBox object.  Strange that it apparent;y executes ComboBox.ClickItem but then complains that it can't find ComboBox.

Ask a SmartBear
Top Kudoed Authors