Can you share the HTML code for your dropdown? If it’s a regular dropdown with <select> and <option>, it should work out of the box. However, if the dropdown is dynamically populated, you may need to take a different approach.
In this case, you would first need to click on the dropdown to reveal the options. Then, wait for the options to load before selecting the desired option.
Here’s a potential solution to your issue:
1. Click the Dropdown
Since the dropdown might be dynamically populated, the first step is to click the dropdown itself to reveal the options.
// Click the dropdown to make options visible
WebUI.click(findTestObject('your_dropdown_object'))
2. Wait for the Options to Load
Next, you’ll want to wait for the options to become visible. This is necessary when options are loaded dynamically.
// Wait for the options to be visible (adjust the XPath based on your actual dropdown options)
WebUI.waitForElementVisible(findTestObject('your_dropdown_options'), 10)
3. Wait for the Option to be Clickable
Now that the options are visible, wait for the specific option to be clickable before selecting it.
// Wait for the specific option to be clickable
WebUI.waitForElementClickable(findTestObject('your_dropdown_option', [('text') : 'Option Text']), 10)
4. Click the Desired Option
Finally, click on the option that you want to select from the dropdown.
// Click the desired option
WebUI.click(findTestObject('your_dropdown_option', [('text') : 'Option Text']))
Full Example:
// Click the dropdown
WebUI.click(findTestObject('Page_YourPage/your_dropdown_object'))
// Wait for options to be visible
WebUI.waitForElementVisible(findTestObject('Page_YourPage/your_dropdown_options'), 10)
// Wait for the specific option to become clickable
WebUI.waitForElementClickable(findTestObject('Page_YourPage/your_dropdown_option', [('text') : 'Option Text']), 10)
// Click the desired option
WebUI.click(findTestObject('Page_YourPage/your_dropdown_option', [('text') : 'Option Text']))