How to use WindowsDriver in Appium to wait for an element to load before clicking on it


I am using Appium with Windows Driver, to test my Windows based Dot net application, using C#… I am trying to click on a link through my automation tests. When my automation test is running, then its not waiting till my element(link) in the application is loaded/visible . Because of this my test fails. Is there a WinAppDriver /Windows Driver waittillElementisvisible property (like how we have in Selenium Webdriver) so that it waits till the element is loaded ? Any help is much appreciated.


Any help with this one ?


You can use this:

public void WaitForElement(string IDType, string elementName, int time)
var wait = new DefaultWait<WindowsDriver>(driver)
Timeout = TimeSpan.FromSeconds(time),
PollingInterval = TimeSpan.FromSeconds(0.5)


        wait.Until(driver =>
              int elementCount = 0;
              switch (IDType)
                  case "id":
                      elementCount = driver.FindElementsByAccessibilityId(elementName).Count;
                  case "xpath":
                      elementCount = driver.FindElementsByXPath(elementName).Count;
                  case "name":
                      elementCount = driver.FindElementsByName(elementName).Count;
              return elementCount > 0;