Coded workflows

Hello I was hoping to learn to use codeded workflows, looking at the documentation I noticed that you could call the UI Automation APIs directly on a UI element.

i.e.

var applicationScreen = uiAutomation.Open(Target.FromSelector("<html app = 'chrome.exe'/>"));
applicationScreen.TypeInto(Target.FromSelector("<webctrl id='generalClick' tag='BUTTON'/>"), "Hello");

however when I try to implement the same I get the following error:

"Cannot convert from 'UiPath.UiAutomationNext.API.Models.TargetAnchorableModel' to 'string'."

to overload the function it does not seem like I have to do anything however?

full code

error

thank you

HI,

It seems type of the class is different.
Can you try as the following? This inputs text into search bar in UiPath Forum.

        var appModel=  new TargetAppModel();
        appModel.WithUrl("https://forum.uipath.com/","<html app = 'chrome.exe'/>",NBrowserType.Chrome);
        var taOptions= new TargetAppOptions();
        taOptions.OpenMode = NAppOpenMode.IfNotOpen;

        var applicationScreen = uiAutomation.Open(appModel,taOptions);
        applicationScreen.TypeInto(Target.FromSelector("<webctrl id='search-term' tag='INPUT' />"), "Hello");

note: uiAutomation.Open(appModel); will also work

Regards,