selenum wait for element c#

58

selenum wait for element c# -

public static bool elexists(By by, WebDriver driver)
    {
        try
        {
            driver.FindElement(by);
            return true;
        }
        catch (NoSuchElementException)
        {
            return false;
        }
    }
    public static void waitforelement(WebDriver driver, By by)
    {
        for (int i = 0; i < 30; i++)
        {
            System.Threading.Thread.Sleep(1000);
            if (elexists(by, driver))
            {
                break;
            }


        }

    }

Comments

Submit
0 Comments