public T this[int number] { get { number = number + 1; if (_tableRowCache.ContainsKey(number)) { return(_tableRowCache[number]); } if (number >= 1 && number <= NumRows) { string xpath = "./tbody[" + this.BodyIndex + "]/tr[" + number + "]"; IWebElement webelement = WebElement.FindElement(By.XPath(xpath)); T tableRow = PageElementFactory.InitElement <T>(WebDriver, webelement); tableRow.TableHeader = TableHeader; _tableRowCache.Add(number, tableRow); return(tableRow); } else { throw new IndexOutOfRangeException("Tried to access invalid row number: " + number); } } }
public string VerifySelectedValue() { var dropdown = WebElement.FindElement(_driver, Dropdown, 10); var selectElement = new SelectElement(dropdown); return(selectElement.SelectedOption.GetAttribute("value").ToString()); }
public void ChooseOptions(string value) { var dropdown = WebElement.FindElement(_driver, Dropdown, 10); var selectElement = new SelectElement(dropdown); selectElement.SelectByValue(value); }
public void SelectItemByPartialText(string partialTextItemToSelect) { WebElement.FindElement(By.XPath($"./option[starts-with(text(), '{partialTextItemToSelect}')]")).Click(); string message = $"The (Dropdown) [ {ControlName} ] selected the Item: [ {partialTextItemToSelect} ] using partial text"; LoggerManagerClass.Instance.Information(message); TestCaseProvider.Instance.AddStepInCurrentTestCase(LogStepStatus.Passed, message); }
public void FindElement() { var htmlNode = new HtmlNodeBuilder("<html><body><div id=\"page-body\">Hello world</div></body></html>").Build(); var document = new WebElement(htmlNode, null); var div = document.FindElement(By.Id("page-body")); Assert.That(div.TagName, Is.EqualTo("div")); Assert.That(div.Text, Is.EqualTo("Hello world")); }
public string HasLeadingSign() { try { WaitForDisplayed(Timeouts.Default); string sign = WebElement.FindElement(By.XPath($"{InputGroupElement}//span[@class='input-group-addon']")).Text; return(sign); } catch (NoSuchElementException) { return(string.Empty); } }
public string HasFollowingSign() { try { WaitForDisplayed(Timeouts.Default); string sign = WebElement.FindElement(By.XPath("./following-sibling::span[@class='input-group-addon']")).Text; return(sign); } catch (NoSuchElementException) { return(string.Empty); } }
public PageElement this[int number] { get { number = number + 1; // HTML tables are 1-index if (number >= 1 && number <= NumColumns) { string xpath = "./td[" + number + "]"; IWebElement cellWebElement = WebElement.FindElement(By.XPath(xpath)); PageElement pageElement = null; // we will try to initialize the contents of the table cell, depending on the tag name of the contents try { WebDriver.EnableWait(false); IWebElement childElement = null; if ((childElement = FindDescendantByType(cellWebElement, "select")) != null) { pageElement = PageElementFactory.InitElement <DropDownList>(WebDriver, childElement); } else if ((childElement = FindDescendantByType(cellWebElement, "input")) != null) { pageElement = PageElementFactory.InitElement <TextField>(WebDriver, childElement); } else { pageElement = PageElementFactory.InitElement <Label>(WebDriver, cellWebElement); } } catch (Exception) { } finally { WebDriver.EnableWait(true); } return(pageElement); } else { throw new IndexOutOfRangeException("Tried to access invalid index number: " + number); } } }
public PageElement this[int number] { get { number = number + 1; if (number >= 1 && number <= NumColumns) { string xpath = "./tr/th[" + number + "]"; IWebElement cellWebElement = WebElement.FindElement(By.XPath(xpath)); PageElement pageElement = PageElementFactory.InitElement <PageElement>(WebDriver, cellWebElement); return(pageElement); } else { throw new IndexOutOfRangeException("Tried to access invalid index number: " + number); } } }
public string GetInputLabel() { WaitForDisplayed(Timeouts.Default); return(WebElement.FindElement(By.XPath($"{InputGroupElement}/preceding-sibling::label/span/span")).Text); }
public ElementSe FindElementSe(By by) { return(new ElementSe(WebElement.FindElement(by))); }
public IWebElement FindElement(By by) { return(WebElement.FindElement(by)); }
public string GetValidationMessage() { WaitForDisplayed(Timeouts.Default); return(WebElement.FindElement(By.XPath($"{InputGroupElement}/following-sibling::div[contains(@id, 'helpblock')]//span[contains(@class,'input-helptext-error')]")).Text); }
public Element <WebLocator> GetChild(WebLocator locator) { return(new SeleniumElement(WebElement.FindElement(locator.By), WebDriver)); }
public UITestControl GetParent() { return(new UITestControl(this.TopParent, WebElement.FindElement(By.XPath("..")))); }
public void ClickOnDropdown() { WebElement.FindElement(_driver, Dropdown, 10).Click(); }
public bool VerifyContributeGraph() { return(WebElement.FindElement(_driver, ContributeGraph, 10).Displayed); }
public void ClickDecrease() { WebElement.FindElement(By.XPath(".//ancestor::div[@class='input-group']//div[@class='input-group-btn']//button[@aria-label='decrease value']")) .Click(); }
public bool VerifDropdown() { return(WebElement.FindElement(_driver, Dropdown, 10).Displayed); }
public void ClickSubmit() { WebElement.FindElement(_driver, SubmitButton, 5).Click(); }
/// <summary> /// Returns the text of cell by its selector. /// </summary> /// <param name="selector">Element selector.</param> /// <returns>Text of cell.</returns> public string GetCellBySelector(By selector) { return(WebElement.FindElement(selector).Text); }
/// <summary> /// Returns cell by its content. /// </summary> /// <param name="content">Cell content.</param> /// <returns>IWebElement that represents searched cell.</returns> public IWebElement GetCellByContent(string content) { return(WebElement.FindElement(By.XPath($"//td[contains(.,'{content}')]"))); }
public void Child(By locator) => WebElement.FindElement(locator);
////// Implements the SearchContext interface. ////// public virtual IWebElement FindElement(By by) { return(WebElement.FindElement(by)); }
public void InputEmail(string email) { WebElement.FindElement(_driver, EmailInput, 5).SendKeys(email); }
public bool VerifyProfile() { return(WebElement.FindElement(_driver, Profile, 10).Displayed); }
public string GetSuccessText() { return(WebElement.FindElement(_driver, Content, 5).Text); }
/// <summary> /// Find an element by the requested locator strategy. /// </summary> /// <param name="by">Locator strategy to use to find a requested element.</param> /// <returns></returns> internal Element FindElement(By by) => new Element(WebElement.FindElement(by), LogManager);