Skip to main content
added 557 characters in body
Source Link

Since you are using CodedUI for this I would write something like this.

public static void GetAllElements(BrowserWindow bw)
{
var a = bw.GetChildren().Where(x => x.GetProperty("TagName").ToString() == "TD");
            foreach (var control in a)
            {
                Console.WriteLine(control.Name);
                Console.WriteLine(control.GetProperty("Id"));
            }
}

Also if you are interested in saving time while hand coding make as many generic methods if you can

public static void ClickHtmlButton(string buttonidentifierType, string buttonIdentifier)
{
    var button = new HtmlButton(bw);
    if buttonidentifierType == "ID"
    {
        button.SearchProperties.Add("Id", buttonIdentifier);
    }
    if buttonidentifierType == "InnerText"
    {
        button.SearchProperties.Add("InnerText", buttonIdentifier);
    }
    Mouse.Click(button);
}

Since you are using CodedUI for this I would write something like this.

public static void GetAllElements(BrowserWindow bw)
{
var a = bw.GetChildren().Where(x => x.GetProperty("TagName").ToString() == "TD");
            foreach (var control in a)
            {
                Console.WriteLine(control.Name);
                Console.WriteLine(control.GetProperty("Id"));
            }
}

Since you are using CodedUI for this I would write something like this.

public static void GetAllElements(BrowserWindow bw)
{
var a = bw.GetChildren().Where(x => x.GetProperty("TagName").ToString() == "TD");
            foreach (var control in a)
            {
                Console.WriteLine(control.Name);
                Console.WriteLine(control.GetProperty("Id"));
            }
}

Also if you are interested in saving time while hand coding make as many generic methods if you can

public static void ClickHtmlButton(string buttonidentifierType, string buttonIdentifier)
{
    var button = new HtmlButton(bw);
    if buttonidentifierType == "ID"
    {
        button.SearchProperties.Add("Id", buttonIdentifier);
    }
    if buttonidentifierType == "InnerText"
    {
        button.SearchProperties.Add("InnerText", buttonIdentifier);
    }
    Mouse.Click(button);
}
Source Link

Since you are using CodedUI for this I would write something like this.

public static void GetAllElements(BrowserWindow bw)
{
var a = bw.GetChildren().Where(x => x.GetProperty("TagName").ToString() == "TD");
            foreach (var control in a)
            {
                Console.WriteLine(control.Name);
                Console.WriteLine(control.GetProperty("Id"));
            }
}