Forum Discussion

EkremMese1's avatar
EkremMese1
Contributor
3 months ago

How can I retrieve the text of that dropdown below?

Hi everyone, 

I am trying to get a text of dropdown in my application. 

Dropdown looks like this in the HTML: 


And in the system it appears like that:

So far I tried innerText, outerText and contentText methods, none of them working.

  • What does that dropdown look like in Object Spy?  Show us the fields please.

  • JDR2500's avatar
    JDR2500
    Frequent Contributor

    If your combo box is not supported, you might be able to get all the items in the list by first dropping down the combo box then using FindAllChildren to get the items in the list.  You would need to find them using a property like "MenuItem" that matches their type.  Once you got them back in an array you could verify what you got, or get the index of the items and then use it to click them.  To click them you would likely need to dropdown the menu again.

    Here is a link to the help topic on FindAllChildren:  FindAllChildren Method | TestComplete Documentation (smartbear.com)

  • MW_Didata's avatar
    MW_Didata
    Regular Contributor

    Since none of the text properties are working you could always brute force it by clicking the textfield, CTRL + A to select all, CTRL + C.

    now the text is stored in your clipboard and you can write that to a variable