/// <summary> /// Finds all <see cref="NgWebElement" />s within the current context /// using the given mechanism. /// </summary> /// <param name="by">The locating mechanism to use.</param> /// <returns> /// A <see cref="ReadOnlyCollection{T}" /> of all <see cref="NgWebElement" />s /// matching the current criteria, or an empty list if nothing matches. /// </returns> public ReadOnlyCollection <NgWebElement> FindElements(By by) { if (by is JavaScriptBy scriptBy) { scriptBy.AdditionalScriptArguments = new object[] { NgDriver.RootElement, WrappedElement } } ; NgDriver.WaitForAngular(); return(new ReadOnlyCollection <NgWebElement>(WrappedElement.FindElements(by) .Select(e => new NgWebElement(NgDriver, e)).ToList())); } IWebElement ISearchContext.FindElement(By by) { return(FindElement(by)); } ReadOnlyCollection <IWebElement> ISearchContext.FindElements(By by) { if (by is JavaScriptBy scriptBy) { scriptBy.AdditionalScriptArguments = new object[] { NgDriver.RootElement, WrappedElement } } ; NgDriver.WaitForAngular(); return(new ReadOnlyCollection <IWebElement>(WrappedElement.FindElements(by) .Select(e => (IWebElement) new NgWebElement(NgDriver, e)).ToList())); } #endregion } }
/// <summary> /// Finds the first <see cref="NgWebElement" /> using the given mechanism. /// </summary> /// <param name="by">The locating mechanism to use.</param> /// <returns>The first matching <see cref="NgWebElement" /> on the current context.</returns> /// <exception cref="NoSuchElementException">If no element matches the criteria.</exception> public NgWebElement FindElement(By by) { if (by is JavaScriptBy scriptBy) { scriptBy.AdditionalScriptArguments = new object[] { NgDriver.RootElement, WrappedElement } } ; NgDriver.WaitForAngular(); return(new NgWebElement(NgDriver, WrappedElement.FindElement(by))); }
public void TestModulo() { const string firstNumber = "5252"; const string secondNumber = "2525"; const string expectedResult = "202"; _calculatorPage.CalculateNumbers(firstNumber, secondNumber, MathematicalOperation.MODULO); NgDriver.WaitForAngular(); Assert.AreEqual(expectedResult, _calculatorPage.GetResult()); }
public void TestMultiplication() { const string firstNumber = "5252"; const string secondNumber = "2525"; const string expectedResult = "13261300"; _calculatorPage.CalculateNumbers(firstNumber, secondNumber, MathematicalOperation.MULTIPLICATION); NgDriver.WaitForAngular(); Assert.AreEqual(expectedResult, _calculatorPage.GetResult()); }
public void TestSubtraction() { const string firstNumber = "5252"; const string secondNumber = "2525"; const string expectedResult = "2727"; _calculatorPage.CalculateNumbers(firstNumber, secondNumber, MathematicalOperation.SUBTRACTION); NgDriver.WaitForAngular(); Assert.AreEqual(expectedResult, _calculatorPage.GetResult()); }
/// <summary> /// Move a single "item" forward in the browser's history. /// </summary> public void Forward() { NgDriver.WaitForAngular(); WrappedNavigation.Forward(); }
/// <summary> /// Move back a single entry in the browser's history. /// </summary> public void Back() { NgDriver.WaitForAngular(); WrappedNavigation.Back(); }
/// <summary> /// Evaluates the expression as if it were on the scope of the current element. /// </summary> /// <param name="expression">The expression to evaluate.</param> /// <returns>The expression evaluated by Angular.</returns> public object Evaluate(string expression) { NgDriver.WaitForAngular(); return(NgDriver.ExecuteScript(ClientSideScripts.Evaluate, WrappedElement, expression)); }
/// <summary> /// Submits this element to the web server. /// </summary> public void Submit() { NgDriver.WaitForAngular(); WrappedElement.Submit(); }
/// <summary> /// Simulates typing text into the element. /// </summary> public void SendKeys(string text) { NgDriver.WaitForAngular(); WrappedElement.SendKeys(text); }
/// <summary> /// Gets the value of a CSS property of this element. /// </summary> public string GetCssValue(string propertyName) { NgDriver.WaitForAngular(); return(WrappedElement.GetCssValue(propertyName)); }
/// <summary> /// Gets the value of the specified attribute for this element. /// </summary> public string GetAttribute(string attributeName) { NgDriver.WaitForAngular(); return(WrappedElement.GetAttribute(attributeName)); }
/// <summary> /// Clicks this element. /// </summary> public void Click() { NgDriver.WaitForAngular(); WrappedElement.Click(); }