Description programming in LeanFT in C#.Net

We can use below syntax in C#.Net to identify the objects using Description programming.

We can pass multiple property-value pairs to identify the object uniquely in LeanFT.

In first example below, we have used XPATH property to identify the input box in a web page. In second example, we have used WindowClassRegExp and WindowTitleRegExp properties to identify the notepad Window. In the last example, we have used WindowClassRegExp and NativeClass properties to identify the text area in notepad.

// Find edit box using Xpath
            IEditField firstName = browser.Describe <IEditField>(new EditFieldDescription
            {
                XPath = "//input[@id='fn']"
                
            });

 IWindow notepadWindow = Desktop.Describe<IWindow>(new WindowDescription
            {
                WindowClassRegExp = "Notepad",
                WindowTitleRegExp = " Notepad"
            });

  IEditor editor = notepadWindow.Describe<IEditor>(new EditorDescription
            {
                WindowClassRegExp = "Edit",
                NativeClass = "Edit"
            });

You may also like...