Get name of current element

Hello

How I can get current active element name?

I have items list and I need to know attribete name of current active element.

I have the scenario:

  1. put cursor at the item
  2. enter into the item
  3. if item have some attribute, close item (after close item vannish from current list)
  4. start again from first item

So, it is take to many time. I need start again and again from first item.
I whant to memorize item name and then start from it.

@Alex7,

I did not understand your query. Could you please tell more details for better understanding.

I edited my question.

Use the Get Attribute activity and set to aaname

I can’t find Get Attribute activity, only Get Attribute.

image

Yes it is

But what I need to enter in pic

?

Enter either the element object or the selector for the element you wish to extract the aaname for

But I don’t know which element.
It can be different elements. I need to know ACTIVE element and then put it in this form.

The active element? As in the last element the robot has interacted with?

For example if the last action was a click, then output the element to an element object. Then you can pass that to the Get Attribute activity to retrieve the aaname

Could you please explain this phrase:
“then output the element to an element object”

I can’t find output section at click property.

Find Element Activity:
> Output to an element object

Get Attribute Activity:
> Pass element object and set to aaname

Print aaname

GetAttributeName.xaml (7.0 KB)

The example has explicit at the element - UiPathLogo.

I have list of elements whith different names:
pic1

When UI click at on of them I need to know this elemet name.

@Alex7

use get attribute activity and use attribute as name in property section

Yes. I just provided it as an example. The flow grabs the UiPath logo as an element object then outputs the aaname of that object.

You should do the same for your own elements, find them, output them to an object variable, then get attribute ‘name’ on that object.

Straight forward really, and the example shows how to achieve that.

When I know the element I can take element name - it’s OK.

But when I don’t know which element active now, I can’t use Find Element. Because I need put element in Input section firstly.

No element is active unless you have directed the robot to activate it surely.

So if you have used a click activity, the element clicked is the active element. If that was within an attach browser activity then the browser is the active element before the click is ‘activated’.

If you are looking for a running stream of all elements interacted with during a workflow without doing it manually, you may need to analyse logs or run it in debug mode for a more comprehensive output log.

I have a similar issue. I want to tab through some fields and then inspect each field to identify attributes about it so that the bot will know what field it is and what to populate. (It is a stubborn application that does not lend itself to the Click and Type Into activities.)

You could look at using the FindChildren activity and set it to Find Descendants.

This will output all possible elements as a datatable and you can access details of each using a For Each loop and the Get Attribute activity.

Thank-you @ronanpeter, I might come back to this option if I have to.