Ask a Question

Using object in auto-complete drop down list

SOLVED
nsievert
Contributor

Using object in auto-complete drop down list

The web application I am testing has a textbox that autocompletes when you start typing in it. 

In my test, I want to SetText in that textbox and then select the one item it populates. I can map this object but during the test it is not selecting the item from the list. In fact, I don't see the list displaying at all after some values are typed in the box.


What can I do? 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
AlexKaras
Community Hero

Re: Using object in auto-complete drop down list

Hi,

 

but seemingly not through TC.

As this is web application, what you need is doable with 99% probability.

Generic sequence of actions (that may vary depending on how the given control has been implemented):

-- Set focus to / click the control and start typing using .Keys() method;

-- Delay script execution until the drop-down window appears after some part of the text has been typed;

-- Investigate the drop-down window in the Object Browser / Object Spy to find out how to identify this window in test code and how to get a list of its elements;

-- Using the results of the above investigation, write a code that, after some portion of text has been typed, will wait for the drop-down window, search for the required element in it and click on the found element.

 

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] 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. Posts made by [Community Heroes]
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.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

6 REPLIES 6
mattb
Staff

Re: Using object in auto-complete drop down list

Hello,

Maybe after you settext, click on the textbox again and see if it will display the autocomplete menu. I would also recommend before selecting the actual item in the autocomplete menu to add a small delay (500 ms max)

Is the method Keys available also? Maybe that would work better for the autocomplete to generate. 

nsievert
Contributor

Re: Using object in auto-complete drop down list

This is not working unfortunately. When I run the test, the autocomplete drop down list is not showing so TC can't find the object to click on it. 

AlexKaras
Community Hero

Re: Using object in auto-complete drop down list

@nsievert :

Hi,

 

Have you tried to use .Keys() instead of .SetText() as it was suggested by @mattb ?

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] 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. Posts made by [Community Heroes]
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.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
nsievert
Contributor

Re: Using object in auto-complete drop down list

Using Keys is unfortunately not working. 

 

I had my test click on the textbox, enter a value, press down and the enter but when replaying it does not actually select the item.

 

I can do this manually on the app but seemingly not through TC. 

AlexKaras
Community Hero

Re: Using object in auto-complete drop down list

Hi,

 

but seemingly not through TC.

As this is web application, what you need is doable with 99% probability.

Generic sequence of actions (that may vary depending on how the given control has been implemented):

-- Set focus to / click the control and start typing using .Keys() method;

-- Delay script execution until the drop-down window appears after some part of the text has been typed;

-- Investigate the drop-down window in the Object Browser / Object Spy to find out how to identify this window in test code and how to get a list of its elements;

-- Using the results of the above investigation, write a code that, after some portion of text has been typed, will wait for the drop-down window, search for the required element in it and click on the found element.

 

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] 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. Posts made by [Community Heroes]
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.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

nsievert
Contributor

Re: Using object in auto-complete drop down list

Thank you!

 

Using a combination of Keys() and Delays I was able to get this to work. 

cancel
Showing results for 
Search instead for 
Did you mean: