How to read text from Label/Dropdown lists

Hi,

I am trying to read text using GetText Attribute from Label/DropDown Lists.
I am able to read the texts which is selected.
For Ex. Label contains “UserName1” and
Dropdown lists highlights “Item1” which can extract “UserName1” and “Item1”

But if the label got changed to “userName2” it is not getting the text from the label instead throws error as “Unable to find the element”

In short I have to create a generic script to extract text from Labels, Dropdownlists, textbox, etc., even if the texts got changed in the element

Thanks,
Nishar Ahamed

Hey @A_NISAR_AHAMED :wave:

If you want to extract the list of items available in the drop-down, you can use Find Children activity and then use Get Attribute activity to get a specific attribute from the selector.

Cheers!

1 Like

Hi,
No, not the list of items …
As I mentioned earlier it should get the text which is selected or displayed
In case of username position, if I have taken the screenshot of “name1” to get text attribute it should be able to get the different text also…

Thanks,
Nishar Ahamed

@A_NISAR_AHAMED

Welcome to forums

Can you share some screenshot and output you are expecting?

Thanks

@A_NISAR_AHAMED Use Get Text activity and modify the selectors as required. If you could maybe post a screenshot, I could help you out with this.

Hi,

image

I am able to extract the text “Nishar Ahamed” from the selected label
If the name got changed to something else like “Ramprasad” it could not identify the element to extract the text.
So If I have to automate and check 1000 user accounts, I should be able to extract the text in that element for all 1000 users using the same script

Please help!