public IWebElement HCPFirstName(string HcpFirstName) { var insuliaSpecificFirstName = char.ToUpper(HcpFirstName[0]) + HcpFirstName.Substring(1).ToLower(); var t = BrowserWait.Until((Browser) => Browser.FindElement(By.XPath($"//tbody/tr/td[contains(text(),'{insuliaSpecificFirstName}')]"))); return(t); }
public bool WaitForPage() { // Wait until a page is fully loaded via JavaScript //WebDriverWait wait = new WebDriverWait(.driver, TimeSpan.FromSeconds(30)); //wait.Until((x) => //{ // return ((IJavaScriptExecutor)this.driver).ExecuteScript( // "return document.readyState").Equals("complete"); //}); var element = BrowserWait.Until(condition => { try { return(((IJavaScriptExecutor)Browser).ExecuteScript( "return document.readyState").Equals("complete")); } catch (StaleElementReferenceException) { return(false); } catch (NoSuchElementException) { return(false); } }); return(element); }
public virtual bool IsPageTitle(string title) { try { BrowserWait.Until(condition: ExpectedConditions.TitleContains(title)); return(true); } catch (NoSuchElementException) { return(false); } }
public virtual bool IsInvisible(By by) { try { BrowserWait.Until(condition: ExpectedConditions.InvisibilityOfElementLocated(by)); return(true); } catch (NoSuchElementException) { return(false); } }
private ReadOnlyCollection <Link> WaitForElements(IBrowser b, TimeSpan timeout) { BrowserWait wait = new BrowserWait(b, timeout); wait.IgnoreExceptionTypes(typeof(NoSuchElementException)); Contaner contaner = wait.Until(x => { Contaner div = b.Window.FindElement <Contaner>(By.XPath(DDMenuSelector)); return((!div.Disabled && !div.Disabled && div.Disabled) ? div : null); }); return(contaner.FindElements <Link>(By.TagName("a"))); }
public virtual bool IsClickable(By by) { try { var found = BrowserWait.Until(condition: ExpectedConditions.ElementToBeClickable(by)); if (found != null) { return(true); } return(false); } catch (NoSuchElementException) { return(false); } }
public virtual bool IsVisible(By by) { try { BrowserWait.Until(condition: ExpectedConditions.ElementIsVisible(by)); return(true); } catch (TimeoutException) { return(false); } catch (NoSuchElementException) { return(false); } }
public virtual bool IsReady(IWebElement e) { BrowserWait.IgnoreExceptionTypes(typeof(NoSuchElementException), typeof(ElementNotVisibleException)); var element = BrowserWait.Until(condition => { try { return(e.Displayed); } catch (StaleElementReferenceException) { return(false); } catch (NoSuchElementException) { return(false); } }); return(element); }
public IWebElement HCPLastName(string HcpLastName) { return(BrowserWait.Until((Browser) => Browser.FindElement(By.XPath($"//tbody/tr/td[contains(text(),'{HcpLastName.ToUpper()}')]")))); }
private void WaitForLogo() { BrowserWait.Until <IWebElement>((d) => { return(d.FindElement(By.Id("gh-logo"))); }); }
public static string getDialogTitle() { BrowserWait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(DialogPage.dialogTitle))); return(Browser.FindElement(By.CssSelector(DialogPage.dialogTitle)).Text); }
public void ExpandDiv(DivSection section, bool expand) { Log.Info($"{GetType().Name}: ExpandDiv(): {section},{expand}"); IWebElement button; IWebElement div; switch (section) { case DivSection.TestNavMenu: button = Browser.FindElement(_navMenuDivButton); div = Browser.FindElement(_navMenuDiv); break; case DivSection.TestTextField: button = Browser.FindElement(_textFieldDivButton); div = Browser.FindElement(_textFieldDiv); break; case DivSection.TestTextInput: button = Browser.FindElement(_textInputDivButton); div = Browser.FindElement(_textInputDiv); break; case DivSection.TestSelectInput: button = Browser.FindElement(_selectDivButton); div = Browser.FindElement(_selectDiv); break; case DivSection.TestCheckboxInput: button = Browser.FindElement(_checkboxDivButton); div = Browser.FindElement(_checkboxDiv); break; case DivSection.TestRadioInput: button = Browser.FindElement(_radioDivButton); div = Browser.FindElement(_radioDiv); break; case DivSection.TestImage: button = Browser.FindElement(_imageDivButton); div = Browser.FindElement(_imageDiv); break; case DivSection.TestTable: button = Browser.FindElement(_tableDivButton); div = Browser.FindElement(_tableDiv); break; case DivSection.TestModal: button = Browser.FindElement(_modalDivButton); div = Browser.FindElement(_modalDiv); break; case DivSection.TestTabMenuNav: button = Browser.FindElement(_tabMenuDivButton); div = Browser.FindElement(_tabMenuDiv); break; case DivSection.TestBrowserConsole: button = Browser.FindElement(_browserConsoleDivButton); div = Browser.FindElement(_browserConsoleDiv); break; default: var msg = $"{GetType().Name}: Unsupported DivSection={section} used for ExpandDiv"; Log.Error(msg); throw new Exception(msg); } if (!expand && div.Displayed) { button.Click(); BrowserWait.Until(driver => div.GetAttribute("class").Contains("collapse")); BrowserWait.Until(driver => !div.Displayed); return; } if (expand && !div.Displayed) { button.Click(); BrowserWait.Until(driver => div.GetAttribute("class").Contains("collapse in")); BrowserWait.Until(driver => div.Displayed); } }
public IWebElement HCPInputFieldBasedLabel(string targetedValue) { var tt = BrowserWait.Until((Browser) => Browser.FindElement(By.XPath($"//*[label='{targetedValue}']"))); return(tt); }
public IWebElement HCPInputFieldBasedOnValue(string targetedValue) { return(BrowserWait.Until((Browser) => Browser.FindElement(By.XPath($"//[@value='{targetedValue}']")))); }
public IWebElement HCPInformationByText(string hcpTargetedInfo) { return(BrowserWait.Until((Browser) => Browser.FindElement(By.XPath($"//tbody/tr/td[contains(text(),'{hcpTargetedInfo}')]")))); }
public IWebElement HCPConfirmationEmail(string HcpConfirmationEmail) { return(BrowserWait.Until((Browser) => Browser.FindElement(By.XPath($"//tbody/tr/td[contains(text(),'{HcpConfirmationEmail}')]")))); }
public static void fillInput(string text) { BrowserWait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(DialogPage.input))); Browser.FindElement(By.CssSelector(DialogPage.input)).SendKeys(text); }