Forum Discussion

vthomeschoolmom's avatar
vthomeschoolmom
Super Contributor
11 years ago

script no enum forcing input of specified values for a drop down

So I am writing a function in javascript that will be consumed by keyword tests and other script tests. It adds a record to a database through the user interface form. On the form there are some drop down lists with fixed lists of values. I want to force the caller of the function to use one of the predefined values, present with a list or whatever.

 

Given this is scripting, I don't think I can do that. Maybe all I can do is handle invalid values in the function. But TestComplete is sometimes more clever than the scripting language it uses. Does anyone know TestComplete Magic that could support this?

 

Thanks

1 Reply


  • vthomeschoolmom wrote:

    It adds a record to a database through the user interface form.


    Is that form the application under test? Is the drop down (combobox) a standard control? If I understand your requirement, then you can write code to select the drop down, enumerate the items in the list, and programatically select the required item. I suggest you review the Selecting Combo Box Items support article, afterwards you can use the TC Macro Recorder to record your actions then review the resulting script that is automatically generated upon completion to better understand the process. As for TestComplete Magic - whether or not the tool supports your requirements, well that is entirely up to you as to how you handle it.  :robothappy: