Exemplo n.º 1
0
 /// <summary>
 /// Private constructor.
 /// (Use static methods for public construction.)
 /// </summary>
 private WaitAndRefresh(IWebLocator locator) :
     base(locator)
 {
     RefreshSeconds    = 3;
     TimeoutSeconds    = null;
     AdditionalSeconds = 0;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Private constructor.
 /// (Use static builder methods to construct.)
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <param name="index">The index of the option to select. Use if not null.</param>
 /// <param name="partialMatch">If true, do partial match on option text. Only applicable for selection by text.</param>
 /// <param name="text">The text of the option to select. Use if not null.</param>
 /// <param name="value">The text of the option to select. Use if not null.</param>
 private Select(IWebLocator locator, int?index = null, bool partialMatch = false, string text = null, string value = null)
     : base(locator)
 {
     Index        = index;
     PartialMatch = partialMatch;
     Text         = text;
     Value        = value;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Private constructor.
 /// (Use static builder methods to construct.)
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <param name="keystrokes">The keystrokes (e.g., text) to send.</param>
 private SendKeys(IWebLocator locator, string keystrokes) : base(locator)
 {
     Clear          = true;
     FinalElement   = null;
     FinalEnter     = false;
     Keystrokes     = keystrokes;
     Private        = false;
     UseClearMethod = false;
 }
        public void SetUpLocator()
        {
            var element = new Mock <IWebElement>();

            WebDriver.Setup(x => x.FindElements(It.IsAny <By>())).Returns(new List <IWebElement> {
                element.Object
            }.AsReadOnly());
            WebDriver.Setup(x => x.FindElement(It.IsAny <By>())).Returns(element.Object);
            Locator = new WebLocator("description", By.Id("id"));
        }
Exemplo n.º 5
0
 /// <summary>
 /// Constructs the Question.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <returns></returns>
 public static Existence Of(IWebLocator locator) => new Existence(locator);
 /// <summary>
 /// Constructs the question.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <returns></returns>
 public static SelectOptionsAvailable For(IWebLocator locator) => new SelectOptionsAvailable(locator);
Exemplo n.º 7
0
 /// <summary>
 /// Private constructor.
 /// (Use static methods for public construction.)
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 private Existence(IWebLocator locator) : base(locator)
 {
 }
Exemplo n.º 8
0
 /// <summary>
 /// Constructs the question.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <returns></returns>
 public static EnabledState Of(IWebLocator locator) => new EnabledState(locator);
Exemplo n.º 9
0
 /// <summary>
 /// Constructs the Question.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <returns></returns>
 public static Count Of(IWebLocator locator) =>
 new Count(locator);
 /// <summary>
 /// Constructs the Question.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <returns></returns>
 public static SelectedOptionText Of(IWebLocator locator) => new SelectedOptionText(locator);
Exemplo n.º 11
0
 /// <summary>
 /// Constructs the task object to select by value.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <param name="value">The value of the option to select.</param>
 /// <returns></returns>
 public static Select ByValue(IWebLocator locator, string value) =>
 new Select(locator, value: value);
Exemplo n.º 12
0
 /// <summary>
 /// Constructs a HtmlAttributeList question for the "value" attribute.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <returns></returns>
 public static HtmlAttributeList For(IWebLocator locator) => HtmlAttributeList.For(locator, Value);
Exemplo n.º 13
0
 /// <summary>
 /// Constructs the question.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <param name="named">The attribute name.</param>
 /// <returns></returns>
 public static HtmlAttributeList For(IWebLocator locator, string named) => new HtmlAttributeList(locator, named);
Exemplo n.º 14
0
 /// <summary>
 /// Private constructor.
 /// (Use static methods for public construction.)
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <param name="propertyName">The attribute name.</param>
 protected HtmlAttributeList(IWebLocator locator, string propertyName) : base(locator, propertyName)
 {
 }
Exemplo n.º 15
0
 /// <summary>
 /// Constructs the Question.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <returns></returns>
 public static Classes Of(IWebLocator locator) => new Classes(locator);
Exemplo n.º 16
0
 /// <summary>
 /// Private constructor.
 /// (Use static methods for public construction.)
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 private Classes(IWebLocator locator) : base(locator)
 {
 }
Exemplo n.º 17
0
 /// <summary>
 /// Constructs the task object to select by index.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <param name="index">The index of the option to select.</param>
 /// <returns></returns>
 public static Select ByIndex(IWebLocator locator, int index) =>
 new Select(locator, index: index);
Exemplo n.º 18
0
 /// <summary>
 /// Constructs the Task.
 /// </summary>
 /// <param name="locator">The locator for whose appearance to wait.</param>
 /// <returns></returns>
 public static WaitAndRefresh For(IWebLocator locator) => new WaitAndRefresh(locator);
Exemplo n.º 19
0
 /// <summary>
 /// Constructs the task object to select by text.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <param name="text">The text of the option to select.</param>
 /// <param name="partialMatch">If true, do partial match on option text.</param>
 /// <returns></returns>
 public static Select ByText(IWebLocator locator, string text, bool partialMatch = false) =>
 new Select(locator, text: text, partialMatch: partialMatch);
Exemplo n.º 20
0
 /// <summary>
 /// Constructs the question.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <returns></returns>
 public static JavaScriptText Of(IWebLocator locator) => new JavaScriptText(locator);
Exemplo n.º 21
0
 /// <summary>
 /// Private constructor.
 /// (Use static methods for public construction.)
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 private Text(IWebLocator locator) : base(locator)
 {
 }
 /// <summary>
 /// Private constructor.
 /// (Use static methods for public construction.)
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 private SelectedOptionText(IWebLocator locator) : base(locator)
 {
 }
Exemplo n.º 23
0
 /// <summary>
 /// Private constructor.
 /// (Use static methods for public construction.)
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 private JavaScriptText(IWebLocator locator) : base(locator)
 {
 }
Exemplo n.º 24
0
 /// <summary>
 /// Constructs the question.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <returns></returns>
 public static Text Of(IWebLocator locator) => new Text(locator);
Exemplo n.º 25
0
 /// <summary>
 /// Private constructor.
 /// (Use static methods for public construction.)
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 private Count(IWebLocator locator) : base(locator)
 {
 }
Exemplo n.º 26
0
 /// <summary>
 /// Private constructor.
 /// (Use static methods for public construction.)
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 private SelectedState(IWebLocator locator) : base(locator)
 {
 }
Exemplo n.º 27
0
 /// <summary>
 /// Private constructor.
 /// (Use static methods for public construction.)
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 private EnabledState(IWebLocator locator) : base(locator)
 {
 }
Exemplo n.º 28
0
 /// <summary>
 /// Constructs the question.
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 /// <returns></returns>
 public static SelectedState Of(IWebLocator locator) => new SelectedState(locator);
Exemplo n.º 29
0
        /// <summary>
        /// Finds all Web elements on the page matching the provided locator and gets a value from each.
        /// </summary>
        /// <param name="actor">The Screenplay Actor.</param>
        /// <param name="driver">The Selenium web driver.</param>
        /// <param name="locator">Locator used to find Web elements.</param>
        /// <param name="getValue">The method used to obtain the desired value from each Web element.</param>
        /// <returns>A list of string values from each Web element found.</returns>
        public static IEnumerable <string> GetValues(IActor actor, IWebDriver driver, IWebLocator locator, Func <IWebElement, string> getValue)
        {
            actor.WaitsUntil(Existence.Of(locator), IsEqualTo.True());
            var elements = driver.FindElements(locator.Query);
            var strings  = from e in elements select getValue(e);

            // ToList() will avoid lazy evaluation
            return(strings.ToList());
        }
 /// <summary>
 /// Private constructor.
 /// (Use static methods for public construction.)
 /// </summary>
 /// <param name="locator">The target Web element's locator.</param>
 private SelectOptionsAvailable(IWebLocator locator) : base(locator)
 {
 }