WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

Enable always returns true

Open ycoliveira opened this issue 7 years ago • 1 comments

So I have a conditional if in my code that looks to a button.enable value, if true, click on it, if false, skip. But the .enable is returning True even when the button isn't enabled. Is that a common issue and is there any turning around for it? (I've looked in the pageSource and enable is true there either)

1

here's my code

    public void DadoQueEuPreenchaOAtendimentoDeCadaItemDaSM()
    {
        var pumaItemsEmbarqueTransbordo = App.Session.FindElementsByAccessibilityId("PUMAItemEmbarqueTransbordo");
        
        foreach (var item in pumaItemsEmbarqueTransbordo)
        {
            item.FindElementByAccessibilityId("picCollapse").Click();
            var editar = item.FindElementByAccessibilityId("btnEditAtendimento");

            if (editar.Enabled)
            {
                editar.Click();
                App.Session.FindElementByName(EditarSM.SelecionarAtendimento).Click();
                item.FindElementByAccessibilityId("picCollapse").Click();
            }
        }
    }

ycoliveira avatar Sep 20 '19 14:09 ycoliveira

What's your app type, Universal Windows Platform (UWP), Windows Forms (WinForms), Windows Presentation Foundation (WPF), and Classic Windows (Win32)? If you hit this randomly, it's possible a timing issue. Maybe you are checking Enabled before click(picCollapse) is completed. So you can sleep seconds before if (editar.Enabled)

licanhua avatar Oct 14 '19 05:10 licanhua