/// <summary> /// Busca um elemento dentro de outro pelo attribute ID, esperando até que o mesmo se encontre pronto (renderizado) /// </summary> /// <param name="customWebElement"></param> /// <param name="id"></param> /// <returns></returns> public static ICustomWebElement WaitFindById(this ICustomWebElement customWebElement, string id) { CustomWebElement customWebelement = new CustomWebElement(() => { return(SeleniumUtils.Wait(() => customWebElement.FindElement(By.Id(id)), id)); }); return(customWebelement); }
/// <summary> /// Busca um elemento dentro de outro pelo attribute ID, esperando até que o mesmo se encontre pronto (renderizado) /// </summary> /// <param name="customWebElement"></param> /// <param name="id"></param> /// <returns></returns> public static ICustomWebElement WaitFindByXPath(this ICustomWebElement customWebElement, string xpath) { CustomWebElement customWebelement = new CustomWebElement(() => { return(SeleniumUtils.Wait(() => customWebElement.FindElement(By.XPath(xpath)), xpath)); }); return(customWebelement); }
/// <summary> /// Busca um elemento dentro de outro pelo seletor, esperando até que o mesmo se encontre pronto (renderizado) /// </summary> /// <param name="customWebElement"></param> /// <param name="selector"></param> /// <returns></returns> public static ICustomWebElement WaitFindBySelector(this ICustomWebElement customWebElement, string selector) { CustomWebElement customWebelement = new CustomWebElement(() => { return(SeleniumUtils.Wait(() => customWebElement.FindElement(By.CssSelector(selector)), selector)); }); return(customWebelement); }
/// <summary> /// Busca um elemento dentro de outro pelo attribute Name, esperando até que o mesmo se encontre pronto (renderizado) /// </summary> /// <param name="customWebElement"></param> /// <param name="name"></param> /// <returns></returns> public static ICustomWebElement WaitFindByName(this ICustomWebElement customWebElement, string name) { CustomWebElement customWebelement = new CustomWebElement(() => { return(SeleniumUtils.Wait(() => customWebElement.FindElement(By.Name(name)), name)); }); return(customWebelement); }
/// <summary> /// Encontra um elemento através de seu ID (lembrando que o ID deverá ser único na página) e aguarda até que o mesmo tenha sido renderizado /// </summary> /// <param name="webDriver"></param> /// <param name="id"></param> /// <param name="maxMilliSecondsWaitTime">Tempo máximo a ser esperado até que o componente tenha sido renderizado</param> /// <returns></returns> public static ICustomWebElement WaitFindById(this IWebDriver webDriver, string id, int maxMilliSecondsWaitTime = 30000) { CustomWebElement customWebelement = new CustomWebElement(() => { return(SeleniumUtils.Wait(() => webDriver.FindElement(By.Id(id)), id, maxMilliSecondsWaitTime)); }); return(customWebelement); }
/// <summary> /// Busca um elemento através de seu seletor, aguardando até que o mesmo seja renderizado com um tiemout de 30 segundos /// </summary> /// <param name="webDriver"></param> /// <param name="selector"></param> /// <param name="maxMilliSecondsWaitTime">Tempo máximo a ser esperado até que o componente tenha sido renderizado</param> /// <returns></returns> public static ICustomWebElement WaitFindBySelector(this IWebDriver webDriver, string selector, int maxMilliSecondsWaitTime = 30000) { CustomWebElement customWebelement = new CustomWebElement(() => { return(SeleniumUtils.Wait(() => webDriver.FindElement(By.CssSelector(selector)), selector, maxMilliSecondsWaitTime)); }); return(customWebelement); }
/// <summary> /// Busca um elemento em uma lista através de seu seletor e índice, aguardando até que o mesmo seja renderizado com um tiemout de 30 segundos /// </summary> /// <param name="webDriver"></param> /// <param name="selector"></param> /// <param name="indice">Índice do elemento a ser retornado</param> /// <param name="maxMilliSecondsWaitTime">Tempo máximo a ser esperado até que o componente tenha sido renderizado</param> /// <returns></returns> public static ICustomWebElement WaitFindElementsBySelector(this IWebDriver webDriver, string selector, int indice, int maxMilliSecondsWaitTime = 30000) { CustomWebElement customWebelement = new CustomWebElement(() => { return(SeleniumUtils.Wait(() => { var list = webDriver.FindElements(By.CssSelector(selector)); if (list.Count < indice) { return null; } else { return list[indice]; } }, selector, maxMilliSecondsWaitTime)); }); return(customWebelement); }