mardi 20 juin 2017

Cannot use local variable "itemsToSelect" before it is declared

All,

I am unsure why this test method is giving me this error. The itemsToSelect variable inside my "Search" case has a red line underneath it.

public void PerformDA1379FormAction(string Action)
{
    auto.AutomationElementCollection itemsToSelect;
    string TL_UIC_YYMM;

    switch (Action)
    {
        case "Search":
            itemsToSelect = auto.AutomationElement.RootElement.FindAll(auto.TreeScope.Descendants, new auto.AndCondition(
                        new auto.PropertyCondition(auto.AutomationElement.ControlTypeProperty, auto.ControlType.ListItem)));

            if (itemsToSelect != null)
            {
                TL_UIC_YYMM = itemsToSelect[1].Current.Name;

                Assert.AreEqual(UIC + " / " + YYMM, TL_UIC_YYMM);

                EdgeUIControl.Invoke(itemsToSelect[1], "Could not invoke list Item");
            }

            Wait(btnSearch).Click("Search button not found", uParent: BrowserPage);

            break;

Aucun commentaire:

Enregistrer un commentaire