Forum Discussion
Here's example code using website https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select
function SelectItem()
{
var page = Sys.Browser().Page("https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select").FindElement("#iframeResult");
var listbox = page.FindElement("//select[@id=(//label[.='Choose a car:']/@for)]");
listbox.ClickItem("Audi");
}
that correctly selects item Audi from the drop down list.
The only issue with ClickItem method, is that it iterates through all items - I've reported the issue, and hopefully it will be fixed in the next patch.
Sorry but this not function for me, the drop down list have several items and ClickItem don't select the correct item.
I have several Dropdown lists in my page but TestComplete don't work correctly. Don't select the correct Item. I have setted some breakpoints, before execute the command I highlight the Dropdown affected by the command and TC highlight it correctly. When I execute the command (ClickItem) TC select the right Item but when the Dropdown is closed the item that is selected is the wrong one.
All this behavior is unacceptable
lodecesa :
Hi,
The code and markup that you've provided look to be correct, so I would report a problem to Support via the https://support.smartbear.com/testcomplete/message/ form. Your case seems to be different from the behavior described by rraghvani, but I am not excluding the possibility that they both have the same root. Thus you may mention rraghvani's case in your ticket as well.