コード例 #1
0
 public ElementWaitUtils(IWebElement element, IWebDriver driver)
 {
     _element             = element;
     _locator             = WebElementUtils.GetLocator(_element);
     _driver              = driver;
     _isTimeToWaitDefined = false;
 }
コード例 #2
0
        public void ThenIAssertThatTheCreatedAndModifiedDatepickersOnThePageAreReadonly(string entityName)
        {
            var entityOnEditPage = new GenericEntityEditPage(entityName, _contextConfiguration);

            Assert.True(WebElementUtils.IsReadonly(entityOnEditPage.CreateAtDatepickerField));
            Assert.True(WebElementUtils.IsReadonly(entityOnEditPage.ModifiedAtDatepickerField));
        }
コード例 #3
0
ファイル: VerifySteps.cs プロジェクト: CodenameLiam/Lactalis
        public void ExpectAnElementToBePresentBy(SelectorPathType selector, string path, string expectedDate)
        {
            By  elementBy   = WebElementUtils.GetElementAsBy(selector, path);
            var elementText = _driver.FindElement(elementBy).Text;

            Assert.Equal(expectedDate, elementText);
        }
コード例 #4
0
        public void PresssKeyOnElementWith(KeyboardActionType keyName, SelectorPathType selector, string path)
        {
            var elementBy = WebElementUtils.GetElementAsBy(selector, path);
            var element   = _driver.FindElement(elementBy);

            KeyboardUtils.EnterKeyToWebElement(element, keyName);
        }
コード例 #5
0
ファイル: VerifySteps.cs プロジェクト: CodenameLiam/Lactalis
        public void ExpectElementByToContainText(SelectorPathType selector, string path, string expectedText)
        {
            By  elementBy   = WebElementUtils.GetElementAsBy(selector, path);
            var elementText = _driver.FindElement(elementBy).Text;

            Assert.Equal(expectedText, elementText);
        }
コード例 #6
0
        public void PasteToElement(SelectorPathType selector, string path)
        {
            var elementBy = WebElementUtils.GetElementAsBy(selector, path);
            var element   = _driver.FindElement(elementBy);

            KeyboardUtils.PasteToWebElement(element);
        }
コード例 #7
0
        public void SelectAllInElement(SelectorPathType selector, string path)
        {
            var elementBy = WebElementUtils.GetElementAsBy(selector, path);
            var element   = _driver.FindElement(elementBy);

            KeyboardUtils.SelectAllFromWebElement(element);
        }
コード例 #8
0
        public void IInsertValidBaseChoiceIntoElement(BaseChoiceType baseChoiceType, SelectorPathType selector, string path)
        {
            By elementBy = WebElementUtils.GetElementAsBy(selector, path);

            WaitUtils.elementState(_driverWait, elementBy, ElementState.EXISTS);

            switch (baseChoiceType)
            {
            case BaseChoiceType.INT:
                TypingUtils.TypeElement(_driver, elementBy, DataUtils.RandInt().ToString());
                break;

            case BaseChoiceType.DOUBLE:
                TypingUtils.TypeElement(_driver, elementBy, DataUtils.RandDouble().ToString());
                break;

            case BaseChoiceType.BOOL:
                TypingUtils.TypeElement(_driver, elementBy, DataUtils.RandBool().ToString());
                break;

            case BaseChoiceType.EMAIL:
                TypingUtils.TypeElement(_driver, elementBy, DataUtils.RandEmail());
                break;
            }
        }
コード例 #9
0
 public ElementWaitUtils(IWebElement element, IWebDriver driver, TimeSpan timeToWait)
     : this(element, driver)
 {
     _element             = element;
     _locator             = WebElementUtils.GetLocator(_element);
     _driver              = driver;
     _isTimeToWaitDefined = true;
     _timeToWait          = timeToWait;
 }
コード例 #10
0
ファイル: AdvancedUtils.cs プロジェクト: viliuszukauskas/Vaft
 /// <summary>Uploads file to input element with type="file"</summary>
 /// <param name="filePath">File path</param>
 public void UploadFile(string filePath)
 {
     if (_element.GetAttribute("class").Split(' ').Contains("hidden"))
     {
         WebElementUtils.UnhideElement(_driver, _element);
         _element.SendKeys(filePath);
         WebElementUtils.HideElement(_driver, _element);
         return;
     }
     _element.SendKeys(filePath);
 }
コード例 #11
0
        /// <summary>Assert that element exists in page source. If element does not exist the method throws an exception.</summary>
        public void IsPresent()
        {
            _driver.VaftExt().TurnOffImplicitlyWait();

            new WebDriverWait(_driver, GetExplicitWait())
            {
                Message = "Element doesn't exist in page source. Locator: " + WebElementUtils.GetLocator(_element)
            }
            .Until(d => !_element.Equals(null));

            _driver.VaftExt().TurnOnImplicitlyWait();
        }
コード例 #12
0
        /// <summary>Assert that element is selected.</summary>
        public void IsNotSelected()
        {
            _driver.VaftExt().TurnOffImplicitlyWait();

            new WebDriverWait(_driver, GetExplicitWait())
            {
                Message = "Element should not be selected. Locator: " + WebElementUtils.GetLocator(_element)
            }.Until(
                d => !_element.Selected);

            _driver.VaftExt().TurnOnImplicitlyWait();
        }
コード例 #13
0
 /// <summary>Assert text of element ignoring case.</summary>
 public void TextEquals(string text, string message)
 {
     try
     {
         StringAssert.AreEqualIgnoringCase(text, _element.Text, message);
     }
     catch (AssertionException)
     {
         WebElementUtils.HighlightElement(_driver, _element);
         throw;
     }
 }
コード例 #14
0
        /// <summary>Assert that element is displayed and enabled. If element is disabled the method throws an exception.</summary>
        public void IsEnabledAndDisplayed()
        {
            _driver.VaftExt().TurnOffImplicitlyWait();

            new WebDriverWait(_driver, GetExplicitWait())
            {
                Message = "Element is not enabled. Locator: " + WebElementUtils.GetLocator(_element)
            }.Until(
                d => _element.Displayed && _element.Enabled);

            _driver.VaftExt().TurnOnImplicitlyWait();
        }
コード例 #15
0
        /// <summary>
        ///     Assert that element is not visible, but exists in page source. If element is visible the method throws an
        ///     exception.
        /// </summary>
        public void IsHidden()
        {
            _driver.VaftExt().TurnOffImplicitlyWait();

            new WebDriverWait(_driver, GetExplicitWait())
            {
                Message = "Element should be hidden. Locator: " + WebElementUtils.GetLocator(_element)
            }.Until(
                d => !_element.Displayed);

            _driver.VaftExt().TurnOnImplicitlyWait();
        }
コード例 #16
0
        /// <summary>
        ///     Assert that element is not displayed in Web page or doesn't exist in page source. If element is displayed the
        ///     method throws an exception.
        /// </summary>
        public void IsNotDisplayed()
        {
            _driver.VaftExt().TurnOffImplicitlyWait();

            new WebDriverWait(_driver, GetExplicitWait())
            {
                Message = "Element should not be visible. Locator: " + WebElementUtils.GetLocator(_element)
            }.Until(
                VaftExpectedConditions.ElementIsNotVisible(_element));

            _driver.VaftExt().TurnOnImplicitlyWait();
        }
コード例 #17
0
 /// <summary>Assert element text starts with another text.</summary>
 public void TextStartsWith(string text, string message)
 {
     try
     {
         StringAssert.StartsWith(text, _element.Text, message);
     }
     catch (AssertionException)
     {
         WebElementUtils.HighlightElement(_driver, _element);
         throw;
     }
 }
コード例 #18
0
 /// <summary>Assert element text ends with another text.</summary>
 public void TextEndsWith(string text)
 {
     try
     {
         StringAssert.EndsWith(text, _element.Text);
     }
     catch (AssertionException)
     {
         WebElementUtils.HighlightElement(_driver, _element);
         throw;
     }
 }
コード例 #19
0
        /// <summary>Assert that element does not exist in page source. If element exists the method throws an exception.</summary>
        public bool IsNotPresent()
        {
            _driver.VaftExt().TurnOffImplicitlyWait();

            var wait = new WebDriverWait(_driver, GetExplicitWait())
            {
                Message = "Element should not exist in page source. Locator: " + WebElementUtils.GetLocator(_element)
            }.Until(
                VaftExpectedConditions.ElementDoesNotExist(_element));

            _driver.VaftExt().TurnOnImplicitlyWait();

            return(wait);
        }
コード例 #20
0
        public void IInsertValidStringBaseChoiceIntoElement(string baseChoiceType, int min, int max, SelectorPathType selector, string path)
        {
            var elementBy = WebElementUtils.GetElementAsBy(selector, path);

            WaitUtils.elementState(_driverWait, elementBy, ElementState.EXISTS);

            switch (baseChoiceType)
            {
            case "wordystring":
                TypingUtils.TypeElement(_driver, elementBy, DataUtils.RandString(min, max));
                break;

            case "string":
                TypingUtils.TypeElement(_driver, elementBy, DataUtils.RandString(min, max));
                break;
            }
        }
コード例 #21
0
ファイル: WaitForSteps.cs プロジェクト: CodenameLiam/Lactalis
        public void WaitForAnElementToBePresentBy(SelectorPathType selector, string path)
        {
            var elementBy = WebElementUtils.GetElementAsBy(selector, path);

            WaitUtils.elementState(_driverWait, elementBy, ElementState.EXISTS);
        }
コード例 #22
0
        public void ClickOnElementBy(SelectorPathType selector, string path)
        {
            var elementBy = WebElementUtils.GetElementAsBy(selector, path);

            MouseClickUtils.ClickOnElement(_driver, _driverWait, elementBy);
        }
コード例 #23
0
ファイル: CheckboxUtils.cs プロジェクト: viliuszukauskas/Vaft
 public CheckboxUtils(IWebElement element)
 {
     _element = element;
     _locator = WebElementUtils.GetLocator(_element);
 }
コード例 #24
0
        public void ScrollToElementBy(SelectorPathType selector, string path)
        {
            By elementBy = WebElementUtils.GetElementAsBy(selector, path);

            ScrollingUtils.scrollToElement(_driver, elementBy);
        }
コード例 #25
0
        public void TypeElementBy(string text, SelectorPathType selector, string path)
        {
            By elementBy = WebElementUtils.GetElementAsBy(selector, path);

            TypingUtils.TypeElement(_driver, elementBy, text);
        }
コード例 #26
0
ファイル: VerifySteps.cs プロジェクト: CodenameLiam/Lactalis
        public void ExpectAnElementToBePresentBy(SelectorPathType selector, string path)
        {
            By elementBy = WebElementUtils.GetElementAsBy(selector, path);

            Assert.True(_driver.FindElement(elementBy).Displayed);
        }
コード例 #27
0
ファイル: WaitForSteps.cs プロジェクト: CodenameLiam/Lactalis
        public void WaitForAnElementToNotBeVisibleBy(SelectorPathType selector, string path)
        {
            var elementBy = WebElementUtils.GetElementAsBy(selector, path);

            WaitUtils.elementState(_driverWait, elementBy, ElementState.NOT_VISIBLE);
        }