FindElementById() public method

Finds the first element in the page that matches the ID supplied
public FindElementById ( string id ) : IWebElement
id string ID of the element
return IWebElement
Exemplo n.º 1
0
        public static IWebElement GetElementById(this RemoteWebDriver driver, string id)
        {
            int triesCount = 0;

            do
            {
                try
                {
                    IWebElement result = driver.FindElementById(id);

                    if (result != null)
                    {
                        return(result);
                    }
                }
                catch
                {
                    Thread.Sleep(250);
                    triesCount++;
                }
            } while (triesCount < 10);

            throw new InvalidOperationException($"Element with id '{id}' couldn't be found.");
        }