UiElement variables intialization

Can I create an UiElement variable with just the selector values? I don’t want to use any activity to return a UIelement and then store it in a Uielement.

I guess you can.

element = new UiElement()
element.Selector= new Selector("<wnd ctrlname='frmAbc' />")

if you want to add tag (Invoke Method)

element.Selector.AddTag(new SelectorTag("<wnd ctrlname='frm123'))

Should I use this in “Invokecode”? In invode code I am getting error " BC30112:UiPath.core.activities.element is a namespace and cannot be used as expression at Line1

Assign activity.

Hi. I tried to apply the suggestion but I could’t implement it completely. Do you have an example or some screen copies for the last part (The part related to element.Selector.AddTag(new SelectorTag("<wnd ctrlname=‘frm123’) via Invoke or Assign)? I didn’t succeed on my side. Thanks a lot for your help.

Hi @saravana_689,

Please mark it as solved, if your problem is solved.
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum

Hi @FautVoir,

Assign activity:

Kind regards,
Robert