Working With Combo Box Controls in Web Applications

Applies to TestComplete 15.45, last modified on December 01, 2022

TestComplete recognizes standard <select> elements in web applications and on web pages as Web Combo Box objects. It can also recognize combo box controls implemented with third-party libraries and frameworks.

In your tests, you can work with these elements using methods and properties of the Web Combo Box object. In addition, you can access attributes of the underlying web element and properties and methods provided to the object by a web browser in which the tested web page or web application is running.

Select items of a combo box

In your tests, you often have to simulate selecting an item of a combo box control on a web page. To do this, you can use the ClickItem method specifying the item to select by its index or its caption. You can also simulate selecting an item by typing its caption in the combo box and by moving up and down the list of combo box items.

The samples below show how to select a combo box item by using the ClickItem method, in keyword tests and in script tests respectively.

In keyword tests

  1. Add the On-Screen Action operation to your keyword test. TestComplete will show the Operation Parameters wizard.

  2. In the wizard, specify the combo box whose item you want to select. You can do it by pointing to the combo box on the web page.

  3. Select the combo box object’s method to call. To simulate selecting an item, use the ClickItem method.

  4. Specify either the index of the item to select or its caption.

    Note: The index must be zero-based.

  5. Click Finish to add the operation and close the wizard.

Selecting an item of a combo box

Click the image to enlarge it.

In script tests

To simulate selecting items of a combo box, use the WebComboBoxObj.ClickItem(Item) method.

The script sample below shows how to simulate selecting a combo box item on a web page:

Web (Cross-Platform)

JavaScript, JScript

function Sample_SelectItem()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers.Item(btChrome).Run(url);

  var cb = Sys.Browser().Page(url).FindElement("#themeName");

  // Select the third item of the Themes combo box
  cb.ClickItem(2);
  // Select the Flex item of the Themes combo box
  cb.ClickItem("Flex");
}

Python

def Sample_SelectItem():
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item[btChrome].Run(url)

  cb = Sys.Browser().Page(url).FindElement("#themeName")

  # Select the third item of the Themes combo box
  cb.ClickItem(2)
  # Select the Flex item of the Themes combo box
  cb.ClickItem("Flex")

VBScript

Sub Sample_SelectItem()
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item(btChrome).Run(url)

  Set cb = Sys.Browser().Page(url).FindElement("#themeName")

  ' Select the third item of the Themes combo box
  cb.ClickItem(2)
  ' Select the Flex item of the Themes combo box
  cb.ClickItem("Flex")
End Sub

DelphiScript

procedure Sample_SelectItem();
var url, cb;
begin  url := 'https://services.smartbear.com/samples/TestComplete15/smartstore/';
  Browsers.Item(btChrome).Run(url);

  cb := Sys.Browser().Page(url).FindElement('#themeName');

  // Select the third item of the Themes combo box
  cb.ClickItem(2);
  // Select the Flex item of the Themes combo box
  cb.ClickItem('Flex');
end;

C++Script, C#Script

function Sample_SelectItem()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers["Item"](btChrome)["Run"](url);

  var cb = Sys["Browser"]()["Page"](url)["FindElement"]("#themeName");

  // Select the third item of the Themes combo box
  cb["ClickItem"](2);
  // Select the Flex item of the Themes combo box
  cb["ClickItem"]("Flex");
}

Web (Classic)

JavaScript, JScript

function Sample_SelectItem()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers.Item(btChrome).Run(url);

  var propNames = new Array("ObjectType", "ObjectIdentifier");
  var propValues = new Array("Select", "themeName");
  var cb = Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, true);
  // Select the third item of the Themes combo box
  cb.ClickItem(2);
  // Select the Flex item of the Themes combo box
  cb.ClickItem("Flex");
}

Python

def Sample_SelectItem():
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item[btChrome].Run(url)

  propNames = ["ObjectType", "ObjectIdentifier"]
  propValues = ["Select", "themeName"]
  cb = Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, True)

  # Select the third item of the Themes combo box
  cb.ClickItem(2)
  # Select the Flex item of the Themes combo box
  cb.ClickItem("Flex")

VBScript

Sub Sample_SelectItem()
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item(btChrome).Run(url)

  propNames = Array("ObjectType", "ObjectIdentifier")
  propValues = Array("Select", "themeName")
  Set cb = Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, True)

  ' Select the third item of the Themes combo box
  cb.ClickItem(2)
  ' Select the Flex item of the Themes combo box
  cb.ClickItem("Flex")
End Sub

DelphiScript

procedure Sample_SelectItem();
var url, propNames, propValues, cb;
begin  url := 'https://services.smartbear.com/samples/TestComplete15/smartstore/';
  Browsers.Item(btChrome).Run(url);

  propNames := ['ObjectType', 'ObjectIdentifier'];
  propValues := ['Select', 'themeName'];
  cb := Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, true);

  // Select the third item of the Themes combo box
  cb.ClickItem(2);
  // Select the Flex item of the Themes combo box
  cb.ClickItem('Flex');
end;

C++Script, C#Script

function Sample_SelectItem()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers["Item"](btChrome)["Run"](url);

  var propNames = new Array("ObjectType", "ObjectIdentifier");
  var propValues = new Array("Select", "themeName");
  var cb = Sys["Browser"]()["Page"](url)["FindChildEx"](propNames, propValues, 15, true);

  // Select the third item of the Themes combo box
  cb["ClickItem"](2);
  // Select the Flex item of the Themes combo box
  cb["ClickItem"]("Flex");
}

Get number of combo box items

In your tests, you may need to get the number of items a combo box contains. To do this, you can use the wItemCount property of the Web Combo Box object.

To compare the number of items against an expected value, you can add a property checkpoint to your test. You can also store the number of items to a variable for future use.

The samples below show how to get the number of combo box items and store it to a variable, in keyword tests and in script tests respectively.

In keyword tests

To get the number of items and store it to a variable, you can use the Set Variable Value operation. For example:

  1. Create a variable that will store the number of items. It can be either a keyword variable or a project or project suite variable.

  2. In your keyword test, add the Set Variable Value operation. TestComplete will open the Operation Parameter wizard.

  3. On the first page of the wizard, select the created variable.

  4. On the next page of the wizard, in the Mode drop-down list, select Object Property, and then click the ellipsis button in the Value edit box.

  5. In the resulting dialog, click Onscreen Object and then point to the combo box control on the web page.

  6. On the next page of the wizard, select the wItemCount property.

  7. Click Finish to complete adding the operation.

Storing the number of combo box items to a variable

Click the image to enlarge it.

In script tests

To get the number of combo box items, use the WebComobBoxObj.wItemCount property. For example, the sample script below shows how to get the number of items and post it to the test log:

Web (Cross-Platform)

JavaScript, JScript

function Sample_GetItemCount()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers.Item(btChrome).Run(url);

  var cb = Sys.Browser().Page(url).FindElement("#themeName");

  // Post the number of combo box items to the test log
  Log.Message(aqString.Format("The total number of Themes combo box items: %i", cb.wItemCount));
}

Python

def Sample_GetItemCount():
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item[btChrome].Run(url)

  cb = Sys.Browser().Page(url).FindElement("#themeName")

  # Post the number of combo box items to the test log
  Log.Message(aqString.Format("The total number of Themes combo box items: %i", cb.wItemCount))

VBScript

Sub Sample_GetItemCount()
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item(btChrome).Run(url)

  Set cb = Sys.Browser().Page(url).FindElement("#themeName")

  ' Post the number of combo box items to the test log
  Log.Message(aqString.Format("The total number of Themes combo box items: %i", cb.wItemCount))
End Sub

DelphiScript

procedure Sample_GetItemCount();
var url, cb;
begin  url := 'https://services.smartbear.com/samples/TestComplete15/smartstore/';
  Browsers.Item(btChrome).Run(url);

  cb := Sys.Browser().Page(url).FindElement('#themeName');

  // Post the number of combo box items to the test log
  Log.Message(aqString.Format('The total number of Themes combo box items: %i', cb.wItemCount));
end;

C++Script, C#Script

function Sample_GetItemCount()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers["Item"](btChrome)["Run"](url);

  var cb = Sys["Browser"]()["Page"](url)["FindElement"]("#themeName");

  // Post the number of combo box items to the test log
  Log["Message"](aqString["Format"]("The total number of Themes combo box items: %i", cb["wItemCount"]));
}

Web (Classic)

JavaScript, JScript

function Sample_GetItemCount()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers.Item(btChrome).Run(url);

  var propNames = new Array("ObjectType", "ObjectIdentifier");
  var propValues = new Array("Select", "themeName");
  var cb = Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, true);
  // Post the number of combo box items to the test log
  Log.Message(aqString.Format("The total number of Themes combo box items: %i", cb.wItemCount));
}

Python

def Sample_GetItemCount():
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item[btChrome].Run(url)

  propNames = ["ObjectType", "ObjectIdentifier"]
  propValues = ["Select", "themeName"]
  cb = Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, True)

  # Post the number of combo box items to the test log
  Log.Message(aqString.Format("The total number of Themes combo box items: %i", cb.wItemCount))

VBScript

Sub Sample_GetItemCount()
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item(btChrome).Run(url)

  propNames = Array("ObjectType", "ObjectIdentifier")
  propValues = Array("Select", "themeName")
  Set cb = Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, True)

  ' Post the number of combo box items to the test log
  Log.Message(aqString.Format("The total number of Themes combo box items: %i", cb.wItemCount))
End Sub

DelphiScript

procedure Sample_GetItemCount();
var url, propNames, propValues, cb;
begin  url := 'https://services.smartbear.com/samples/TestComplete15/smartstore/';
  Browsers.Item(btChrome).Run(url);

  propNames := ['ObjectType', 'ObjectIdentifier'];
  propValues := ['Select', 'themeName'];
  cb := Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, true);

  // Post the number of combo box items to the test log
  Log.Message(aqString.Format('The total number of Themes combo box items: %i', cb.wItemCount));
end;

C++Script, C#Script

function Sample_GetItemCount()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers["Item"](btChrome)["Run"](url);

  var propNames = new Array("ObjectType", "ObjectIdentifier");
  var propValues = new Array("Select", "themeName");
  var cb = Sys["Browser"]()["Page"](url)["FindChildEx"](propNames, propValues, 15, true);

  // Post the number of combo box items to the test log
  Log["Message"](aqString["Format"]("The total number of Themes combo box items: %i", cb["wItemCount"]));
}

Get combo box items

To get individual items of a combo box, you can use the following properties:

  • Use the wItem property to get the caption of the item specified by its index.

  • Use the wText property and the wSelectedItem property to get the caption and the index of the item that is currently selected in the combo box.

To compare obtained values against an expected value, you can use property checkpoints. You can also store the obtained items to a variable for later use.

The samples below show how to get the caption of the first item of a combo box and store it to a variable, in keyword tests and in script tests respectively.

In keyword tests

  1. Create a variable that will store the caption. It can be either a keyword variable or a project or project suite variable.

  2. In your keyword test, add the Set Variable Value operation. TestComplete will open the Operation Parameter wizard.

  3. On the first page of the wizard, select the created variable.

  4. On the next page of the wizard, in the Mode drop-down list, select Object Property, and then click the ellipsis button in the Value edit box.

  5. In the resulting dialog, click Onscreen Object and then point to the combo box control on the web page.

  6. On the next page of the wizard, select the wItem property. Then, click param and enter the index of the item. In our example, the index of the first item is 0.

    Note: To get the total number of combo box items, use the wItemCount property.

  7. Click Finish to complete adding the operation.

Storing the caption of a combo box item to a variable

Click the image to enlarge it.

In script tests

The sample script below shows how to get the caption of the first item of a combo box and post it to the test log:

Web (Cross-Platform)

JavaScript, JScript

function Sample_GetItem()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers.Item(btChrome).Run(url);

  var cb = Sys.Browser().Page(url).FindElement("#themeName");

  // Post the caption of the first combo box item to the test log
  if (cb.wItemCount > 0)
    Log.Message(cb.wItem(0));
}

Python

def Sample_GetItem():
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item[btChrome].Run(url)

  cb = Sys.Browser().Page(url).FindElement("#themeName")

  # Post the caption of the first combo box item to the test log
  if (cb.wItemCount > 0):
    Log.Message(cb.wItem[0]);

VBScript

Sub Sample_GetItem()
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item(btChrome).Run(url)

  Set cb = Sys.Browser().Page(url).FindElement("#themeName")

  ' Post the caption of the first combo box item to the test log
  If cb.wItemCount > 0 Then
    Log.Message(cb.wItem(0))
  End If
End Sub

DelphiScript

procedure Sample_GetItem();
var url, cb;
begin  url := 'https://services.smartbear.com/samples/TestComplete15/smartstore/';
  Browsers.Item(btChrome).Run(url);

  cb := Sys.Browser().Page(url).FindElement('#themeName');

  // Post the caption of the first combo box item to the test log
  if cb.wItemCount > 0 then
    Log.Message(cb.wItem(0));
end;

C++Script, C#Script

function Sample_GetItem()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers["Item"](btChrome)["Run"](url);

  var cb = Sys["Browser"]()["Page"](url)["FindElement"]("#themeName");

  // Post the caption of the first combo box item to the test log
  if (cb["wItemCount"] > 0)
    Log["Message"](cb["wItem"](0));
}

Web (Classic)

JavaScript, JScript

function Sample_GetItem()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers.Item(btChrome).Run(url);

  var propNames = new Array("ObjectType", "ObjectIdentifier");
  var propValues = new Array("Select", "themeName");
  var cb = Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, true);
  // Post the caption of the first combo box item to the test log
  if (cb.wItemCount > 0)
    Log.Message(cb.wItem(0));
}

Python

def Sample_GetItem():
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item[btChrome].Run(url)

  propNames = ["ObjectType", "ObjectIdentifier"]
  propValues = ["Select", "themeName"]
  cb = Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, True)

  # Post the caption of the first combo box item to the test log
  if (cb.wItemCount > 0):
    Log.Message(cb.wItem[0])

VBScript

Sub Sample_GetItem()
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item(btChrome).Run(url)

  propNames = Array("ObjectType", "ObjectIdentifier")
  propValues = Array("Select", "themeName")
  Set cb = Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, True)

  ' Post the caption of the first combo box item to the test log
  If cb.wItemCount > 0 Then
    Log.Message(cb.wItem(0))
  End If
End Sub

DelphiScript

procedure Sample_GetItem();
var url, propNames, propValues, cb;
begin  url := 'https://services.smartbear.com/samples/TestComplete15/smartstore/';
  Browsers.Item(btChrome).Run(url);

  propNames := ['ObjectType', 'ObjectIdentifier'];
  propValues := ['Select', 'themeName'];
  cb := Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, true);

  // Post the caption of the first combo box item to the test log
  if cb.wItemCount > 0 then
    Log.Message(cb.wItem(0));
end;

C++Script, C#Script

function Sample_GetItem()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers["Item"](btChrome)["Run"](url);

  var propNames = new Array("ObjectType", "ObjectIdentifier");
  var propValues = new Array("Select", "themeName");
  var cb = Sys["Browser"]()["Page"](url)["FindChildEx"](propNames, propValues, 15, true);

  // Post the caption of the first combo box item to the test log
  if (cb["wItemCount"] > 0)
    Log["Message"](cb["wItem"](0));
}

Open and close drop-down lists

When simulating user actions over a combo box on a web page, you may need to open its drop-down list or to close it. To do this, you can use the DropDown and CloseUp methods of the Web Combo Box object. You can also do it by simulating clicks on the drop-down button of the combo box. Before simulating these actions, you may want to check if the list is already opened or closed.

The samples below show how to check if the drop-down list of the combo box is opened and how to open or close the list, in keyword tests and in script tests respectively.

In keyword tests

To check if the drop-down list is opened or closed and perform various actions depending on the result, you can use the If … Then and Else operations:

  1. Add the If … Then operation to your test.

  2. Specify the condition that will get the state of the combo box drop-down list and compare it against the expected value:

    1. In the Value 1 column of the Operation Parameters dialog, click the ellipsis button.

    2. In the resulting Edit Value dialog, set the mode to Object Property.

    3. Set the value to Onscreen Object.

    4. Point to the combo box on the web page.

    5. To get the list state, select the wisDropDownOpened property.

    6. Click OK to close the dialog.

    7. In the Value 2 column, enter the baseline value against which the list state will be compared: true for opened and false for closed.

    8. Click OK to save the changes and close the Operation Parameters dialog.

  3. To specify operations to run if the check box has the expected state, add them as child items of the If … Then operation. For example, add the On-Screen Action operation as a child item of the If … Then operation and configure it to close the drop-down list if it is opened. Use the CloseUp method to do this.

  4. To specify the operation to run otherwise, add the Else operation right after the If … Then operation, and then add the needed operations as child items of the Else operation. For example, add the On-Screen Action operation and configure it to open the drop-down list. Use the DropDown method to do this.

Openeing and closing the drop-down list of a combo box

Click the image to enlarge it.

In script tests

Web (Cross-Platform)

JavaScript, JScript

function Sample_DropDown()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers.Item(btChrome).Run(url);

  var cb = Sys.Browser().Page(url).FindElement("#themeName");

  // Check if the drop-down list is opened
  if (cb.wIsDropDownOpened)
    // Close the drop-down list
    cb.CloseUp();
  else
    // Open the drop-down list
    cb.DropDown();
}

Python

def Sample_DropDown():
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item[btChrome].Run(url)

  cb = Sys.Browser().Page(url).FindElement("#themeName")

  # Check if the drop-down list is opened
  if (cb.wIsDropDownOpened):
    # Close the drop-down list
    cb.CloseUp()
  else:
    # Open the drop-down list
    cb.DropDown()

VBScript

Sub Sample_DropDown()
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item(btChrome).Run(url)

  Set cb = Sys.Browser().Page(url).FindElement("#themeName")

  ' Check if the drop-down list is opened
  If cb.wIsDropDownOpened Then
    ' Close the drop-down list
    cb.CloseUp
  Else
    ' Open the drop-down list
    cb.DropDown
  End If
End Sub

DelphiScript

procedure Sample_DropDown();
var url, cb;
begin  url := 'https://services.smartbear.com/samples/TestComplete15/smartstore/';
  Browsers.Item(btChrome).Run(url);

  cb := Sys.Browser().Page(url).FindElement('#themeName');

  // Check if the drop-down list is opened
  if cb.wIsDropDownOpened then
    // Close the drop-down list
    cb.CloseUp()
  else
    // Open the drop-down list
    cb.DropDown();
end;

C++Script, C#Script

function Sample_DropDown()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers["Item"](btChrome)["Run"](url);

  var cb = Sys["Browser"]()["Page"](url)["FindElement"]("#themeName");

  // Check if the drop-down list is opened
  if (cb["wIsDropDownOpened"])
    // Close the drop-down list
    cb["CloseUp"]();
  else
    // Open the drop-down list
    cb["DropDown"]();
}

Web (Classic)

JavaScript, JScript

function Sample_DropDown()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers.Item(btChrome).Run(url);

  var propNames = new Array("ObjectType", "ObjectIdentifier");
  var propValues = new Array("Select", "themeName");
  var cb = Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, true);
  // Check if the drop-down list is opened
  if (cb.wIsDropDownOpened)
    // Close the drop-down list
    cb.CloseUp();
  else
    // Open the drop-down list
    cb.DropDown();
}

Python

def Sample_DropDown():
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item[btChrome].Run(url)

  propNames = ["ObjectType", "ObjectIdentifier"]
  propValues = ["Select", "themeName"]
  cb = Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, True)

  # Check if the drop-down list is opened
  if (cb.wIsDropDownOpened):
    # Close the drop-down list
    cb.CloseUp()
  else:
    # Open the drop-down list
    cb.DropDown()

VBScript

Sub Sample_DropDown()
  url = "https://services.smartbear.com/samples/TestComplete15/smartstore/"
  Browsers.Item(btChrome).Run(url)

  propNames = Array("ObjectType", "ObjectIdentifier")
  propValues = Array("Select", "themeName")
  Set cb = Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, True)

  ' Check if the drop-down list is opened
  If cb.wIsDropDownOpened Then
    ' Close the drop-down list
    cb.CloseUp
  Else
    ' Open the drop-down list
    cb.DropDown
  End If
End Sub

DelphiScript

procedure Sample_DropDown();
var url, propNames, propValues, cb;
begin  url := 'https://services.smartbear.com/samples/TestComplete15/smartstore/';
  Browsers.Item(btChrome).Run(url);

  propNames := ['ObjectType', 'ObjectIdentifier'];
  propValues := ['Select', 'themeName'];
  cb := Sys.Browser().Page(url).FindChildEx(propNames, propValues, 15, true);

  // Check if the drop-down list is opened
  if cb.wIsDropDownOpened then
    // Close the drop-down list
    cb.CloseUp()
  else
    // Open the drop-down list
    cb.DropDown();
end;

C++Script, C#Script

function Sample_DropDown()
{
  var url = "https://services.smartbear.com/samples/TestComplete15/smartstore/";
  Browsers["Item"](btChrome)["Run"](url);

  var propNames = new Array("ObjectType", "ObjectIdentifier");
  var propValues = new Array("Select", "themeName");
  var cb = Sys["Browser"]()["Page"](url)["FindChildEx"](propNames, propValues, 15, true);

  // Check if the drop-down list is opened
  if (cb["wIsDropDownOpened"])
    // Close the drop-down list
    cb["CloseUp"]();
  else
    // Open the drop-down list
    cb["DropDown"]();
}

See Also

Working With Application Objects and Controls
Web and RIA Testing

Highlight search results