Help with storing UI element into a Variable

Hello All,

I need help with UI automation. I have a need to go to a site, look for UI elements (some texts) and store the elements into variable. NOTE: These UI elements could change values (dynamic) but they will always stay in the same position. So I always want my automation to grab whatever text is there when the automation run and store that text into a variable.

In the screenshot above, I want to copy the UiElement “Harvard University” into a variable. I also want to copy and save “100.0” into another variable.

So far, I have used the “Click Text" and "Get Text” activities but I was getting some errors- see below:

I also tried the OCR but did not work. Attached is my workflow.
Help will be appreciated.

getUiElementIntoAVariable.zip (9.0 KB)

Hello Yomi,

The easiest way to extract this kind of data is to table extraction which would pull all the required data from all the required fields for that particular university into a row of a data table. And not just that it would also extract all the data from list into the same data table which can be copied to a excel. Below is the image for helping you with extraction.

1 Like

Hi,

In this case, we can use just GetText as the following.

Or you can use ForEachUiElement if you need to get information for all the university.
Please try sequence.xaml in the following zip.

Sample
getUiElementIntoAVariableV2.zip (17.6 KB)

Regards,

1 Like

Thanks for this suggestion

@Yoichi Thanks for this suggestion.
I do have a question about the second solution. Assuming the UI element can be drilled down, for example


image

Is it possible to grab the content/text of the root element and the one nested under it?

If Get Text is failing then you just have to fix your selectors. Open UI Explorer, indicate each element and post a screenshot of what it gives you as the selector. Include the additional properties on the right in your screenshots.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.