Forum Discussion

Sergey_R_'s avatar
Sergey_R_
New Contributor
14 years ago

How would you test this kind of dynamically generated list?

Hi,



I’m a new in TestComplete and just trying to understand how

it works. We are evaluating a version 8.7.


I have a question about testing of dynamically generated menus.



When I record my test TestComplete automatically inserts HoverMouse

operation. Good. But when I play the test I've got the “Object does not exist” error (An

error occurred while calling the "HoverMouse"…)


My example goes from the public site www.southwest.com.

So, anybody can go there and try to repeat my very simple test.


1. Go to the site

2. Enter departure airport (for Example, for San Francisco enter SFO)

3. As soon as you entered SFO, the drop down list will be generated with all airports in San Francisco area.

(Please see the attached file)

4. I selected something from the list and stop recording.


When I play the test it failed. Of course, the generated list does not exists.


So, there are two questions:

1. How can I test the list of those airports? (Every time when I enter

different airport codes the drop down list will have a different content.)



2. How TestComplete can select (click) on any options from the list? (As I

said, HoverMouse operation has been already inserted in the test automaticaly)


Thanks.






  • Hi Alex,



    But when I play the test I've got the “Object does not exist” error (An

    error occurred while calling the "HoverMouse"…)


    I guess this problem occurs because your recorded test uses the default SetText method for text input. This method changes the text in text boxes programmatically, and so may not raise certain web element events that seem to be used on your tested web site. Since these events are not raised, the drop-down list with airports doesn't appear during the test run.



    To resolve the problem, you need to replace SetText in your test with Keys - a method for simulating actual key presses. In this case, all text input events will be raised properly, the drop-down list will appear as expected, and your test will be executed correctly.



    You can also command TestComplete to always record text input using the Keys method instead of SetText. To do this, go to Tools > Options > Engines > Recording and set the Record text input into simple editors option to Keys.





    1. How can I test the list of those airports? (Every time when I enter

    different airport codes the drop down list will have a different content.)


    You can create a property checkpoint to verify text in the drop-down list. To capture the drop-down list when selecting a target for the checkpoint, use the "point and fix" technique. I've attached a short video that demonstrates how to do this.





    2. How TestComplete can select (click) on any options from the list? (As I

    said, HoverMouse operation has been already inserted in the test automaticaly)


    The recorded operations for item selection should work fine once you change SetText to Keys as I've explained above.



    Hope this helps!
  • Sergey_R_'s avatar
    Sergey_R_
    New Contributor
    Hi Helen,



    I have another problem with this site.

    TestComplete works with one kind of menu when I play my test, but does not work with other.

    Please see attached files.



    Test is simple: 

    1.  go to www.southwest.com 

    2.  click on any option from "blue" menu (Air , Hotel, Car or Vacation.) Please see attached South2.jpg. 

    3. stop recording.



    It will fail when playing (Object not found). 

    It failed even if I recorded a Click on menu. The same result if I would record mouse movement over the menu item and then select something from the drop down list.



    Thanks.

  • Hi Alex,



    From what I've observed, the problem seems to be in the recorded identification properties of the "Air" and other "blue" menu links in Name Mapping (the object repository). Specifically, the namePropStr property includes the URL link, but the URL of these links changes dynamically when you place the mouse over them. For example, the original URL of the "Air" link that is specified in the web page source is /flight?int=GNAVBOOKAIR, but when you place the mouse over it, it becomes /flight?int=GNAVBOOKAIR&disc=&ss=0&cid=&companyName=&memberName=.

    The recorded namePropStr property value includes this final dynamically generated URL. But at the run time, the link's initial URL is different, so the link cannot be identified.



    To resolve the problem, you need to edit Name Mapping and either remove the namePropStr property from the links' identification properties, or replace the dynamic parameters in the namePropStr value with the * wildcard -- as it's shown in the attached screenshot.



    To quickly find the needed objects in Name Mapping, you can do the following:

    * Open the Object Spy and select the "Air" link.

    * Right-click somewhere within the property list and select Show Object in Name Mapping Editor.

    Then, repeat these steps for other links (Hotel, Car, etc.)



    Please let me know if this is the case, and whether this suggestion helps.





    By the way, you may be interested in watching our webinar on the subject:

    Creating Reliable Tests For Dynamic Objects with Name Mapping

    It describes hints and tips for selecting stable identifiers for the objects in web applications.