예제 #1
0
 public void Select()
 {
     if (!Selected)
     {
         WrappedElement.Click();
     }
 }
예제 #2
0
 public void Deselect()
 {
     if (Selected)
     {
         WrappedElement.Click();
     }
 }
예제 #3
0
 public void Check(bool isChecked = true)
 {
     if (isChecked && !WrappedElement.Selected || !isChecked && WrappedElement.Selected)
     {
         WrappedElement.Click();
     }
 }
예제 #4
0
 /// <summary>
 /// Click a webelement
 /// </summary>
 public void Click()
 {
     try
     {
         WrappedElement.Click();
     }
     catch (StaleElementReferenceException e)
     {
         if (Driver != null && by != null)
         {
             Logger.Info("Caught exception {0}. Attempting to re-initialize element", e.Message);
             InitializeElement();
             WrappedElement.Click();
         }
         else
         {
             throw;
         }
     }
     catch (Exception e)
     {
         Logger.Error(e);
         throw;
     }
     Logger.Info("Clicked the element : {0}", by);
 }
예제 #5
0
 /// <summary>
 /// Set a <see cref="HtmlCheckBox"/> to a specific value
 /// </summary>
 /// <param name="selected"></param>
 public void Set(bool selected)
 {
     if (selected != WrappedElement.Selected)
     {
         WrappedElement.Click();
     }
 }
예제 #6
0
 /// <summary>
 ///     The deselect.
 /// </summary>
 public virtual void Deselect()
 {
     if (Selected)
     {
         Logger.WriteLine(string.Format(CultureInfo.InvariantCulture, "Uncheck the checkbox '{0}'", Name));
         WrappedElement.Click();
     }
 }
예제 #7
0
        internal void Click(EventHandler <ElementActionEventArgs> clicking, EventHandler <ElementActionEventArgs> clicked)
        {
            clicking?.Invoke(this, new ElementActionEventArgs(this));

            WrappedElement.Click();

            clicked?.Invoke(this, new ElementActionEventArgs(this));
        }
예제 #8
0
        public UpWebElement Click()
        {
            UpDriver.WaitForPageReady();
            Log.GetLogger().Info($"Clicking element [{ElementIdentifier}]");
            WrappedElement.Click();

            return(this);
        }
예제 #9
0
        internal void Click(EventHandler <ComponentActionEventArgs <TDriverElement> > clicking, EventHandler <ComponentActionEventArgs <TDriverElement> > clicked)
        {
            clicking?.Invoke(this, new ComponentActionEventArgs <TDriverElement>(this));

            WrappedElement.Click();

            clicked?.Invoke(this, new ComponentActionEventArgs <TDriverElement>(this));
        }
예제 #10
0
 public void Deselect()
 {
     if (Selected)
     {
         WaitUntilVisible(this.by);
         WaitUntilClickable(this.by);
         WrappedElement.Click();
     }
 }
        /// <summary>
        /// Opens the drop down and returns the option.
        /// </summary>
        /// <param name="optionText">The option.</param>
        /// <param name="stringComparison">The string comparison.</param>
        /// <returns></returns>
        /// <exception cref="NoSuchElementException"></exception>
        public virtual MenuItemComponent SelectOption(string optionText,
                                                      StringComparison stringComparison = StringComparison.Ordinal)
        {
            // This isn't ideal but since the dropdown menu items are
            // generated on the first time the parent menu item is clicked,
            // click the parent element, wait 500 ms (should be enough time for
            // the dropdown to be generated), and move the mouse below the
            // parent element to locate the dropdown container.
            WrappedElement.Click();
            Thread.Sleep(500);

            // Determine where the float-menu will appear. Usually it's either
            // directly below or to the right.
            var(X, Y) = GetDirectionFloatMenuWillOpen();

            // Move below the WrappedElement.
            WrappedDriver.CreateActions()
            .MoveToElement(
                toElement: WrappedElement,
                offsetX: X,
                offsetY: Y,
                offsetOrigin: MoveToElementOffsetOrigin.Center)
            .Perform();

            // Get the container element under the mouse.
            var focusedElement = WrappedDriver
                                 .GetHoveredElements(allMenuDropDownsSelector)
                                 .First();

            var menuItemEl = focusedElement.FindElements(dropDownItemsSelector)
                             .FirstOrDefault(el =>
            {
                var textEl = el.FindElements(textSelector)
                             .FirstOrDefault();

                return(textEl == null
                        ? false
                        : String.Equals(
                           textEl.TextHelper().InnerText,
                           optionText,
                           stringComparison));
            });

            if (menuItemEl == null)
            {
                throw new NoSuchElementException();
            }

            var selector = ByElement.FromElement(menuItemEl);

            return(PageObjectFactory.PrepareComponent(
                       new MenuItemComponent(
                           selector,
                           PageObjectFactory,
                           WrappedDriver)));
        }
예제 #12
0
        private void DisplayCalendar()
        {
            if (IsPopup && !CalendarContainerElement.Displayed)
            {
                WrappedElement.Click();

                WrappedDriver.Wait(datePickerComponentOptions.AnimationDuration)
                .Until(d => CalendarContainerElement.Displayed);
            }
        }
예제 #13
0
 /// <summary>
 ///     The select.
 /// </summary>
 public override void Select()
 {
     Logger.WriteLine(string.Format(CultureInfo.InvariantCulture, "Check the checkbox '{0}'", Name));
     if (PartiallySelected)
     {
         WrappedElement.Click();
     }
     else
     {
         base.Select();
     }
 }
예제 #14
0
        public void SelectByText(string value)
        {
            Selecting?.Invoke(this, new ElementActionEventArgs <IOSElement>(this, value));

            if (WrappedElement.Text != value)
            {
                WrappedElement.Click();
                var elementCreateService = ServicesCollection.Current.Resolve <ElementCreateService>();
                var innerElementToClick  = elementCreateService.CreateByValueContaining <RadioButton>(value);
                innerElementToClick.Click();
            }

            Selected?.Invoke(this, new ElementActionEventArgs <IOSElement>(this, value));
        }
예제 #15
0
파일: Button.cs 프로젝트: MaryiaNeiman/TAF2
 public void Click()
 {
     try
     {
         WaitUntilVisible(this.by);
         WaitUntilClickable(this.by);
         WrappedElement.Click();
         LoggerHandler.WriteToLog($"Button Click {name}");
     }
     catch (Exception ex)
     {
         LoggerHandler.WtiteErrorToLog($"Button {name} Unclickable", ex);
     }
 }
예제 #16
0
        /// <summary>
        /// Tries to collapses the node.
        /// </summary>
        /// <returns></returns>
        public virtual IAdminMainSideBarNodeComponent Collapse()
        {
            if (CanBeExpanded && IsExpanded())
            {
                WrappedElement.Click();

                // Wait until the sub-menu is hidden.
                WrappedDriver
                .Wait(TimeSpan.FromSeconds(2))
                .Until(d => !SubMenuElement.Displayed);
            }

            return(this);
        }
예제 #17
0
 public void Click()
 {
     try
     {
         WaitUntilVisible(this.by);
         WaitUntilClickable(this.by);
         WrappedElement.Click();
         LoggerHandler.WriteToLog($"RadioButton was {name} clicked");
     }
     catch (Exception ex)
     {
         LoggerHandler.WtiteErrorToLog($"RadioButton wasn't {name} clicked", ex);
     }
 }
예제 #18
0
        public virtual void SelectByText(string value)
        {
            Selecting?.Invoke(this, new ComponentActionEventArgs <OpenQA.Selenium.Appium.Android.AndroidElement>(this, value));

            if (WrappedElement.Text != value)
            {
                WrappedElement.Click();
                var elementCreateService = ServicesCollection.Current.Resolve <ComponentCreateService>();
                var innerElementToClick  = elementCreateService.CreateByTextContaining <RadioButton>(value);
                innerElementToClick.Click();
            }

            Selected?.Invoke(this, new ComponentActionEventArgs <OpenQA.Selenium.Appium.Android.AndroidElement>(this, value));
        }
예제 #19
0
 public void Select()
 {
     try
     {
         if (!Selected)
         {
             WaitUntilVisible(this.by);
             WaitUntilClickable(this.by);
             WrappedElement.Click();
             LoggerHandler.WriteToLog($"CheckBox {name} Selected");
         }
     }
     catch (Exception ex)
     {
         LoggerHandler.WtiteErrorToLog($"CheckBox {name} can't be select", ex);
     }
 }
예제 #20
0
        internal void Click(EventHandler <ComponentActionEventArgs> clicking, EventHandler <ComponentActionEventArgs> clicked)
        {
            clicking?.Invoke(this, new ComponentActionEventArgs(this));

            var sleepInterval         = ConfigurationService.GetSection <WebSettings>().TimeoutSettings.SleepInterval;
            var timeout               = ConfigurationService.GetSection <WebSettings>().TimeoutSettings.ElementToBeClickableTimeout;
            var timeoutTimeSpan       = TimeSpan.FromSeconds(timeout);
            var sleepIntervalTimeSpan = TimeSpan.FromSeconds(sleepInterval);
            var wait = new WebDriverWait(new SystemClock(), WrappedDriver, timeoutTimeSpan, sleepIntervalTimeSpan);

            wait.IgnoreExceptionTypes(typeof(NoSuchElementException));

            try
            {
                wait.Until((s) =>
                {
                    try
                    {
                        this.ToExists().ToBeClickable().WaitToBe();
                        WrappedElement.Click();
                        return(true);
                    }
                    catch (ElementNotInteractableException e)
                    {
                        return(false);
                    }
                    catch (WebDriverTimeoutException e)
                    {
                        return(false);
                    }
                    catch (Exception e)
                    {
                        return(false);
                    }
                });
            }
            catch (Exception e)
            {
                JavaScriptService.Execute("arguments[0].focus();arguments[0].click();", this);
            }

            clicked?.Invoke(this, new ComponentActionEventArgs(this));
        }
예제 #21
0
 public void Click()
 {
     Clicking?.Invoke(this, new ComponentActionEventArgs(this));
     WrappedElement.Click();
     Clicked?.Invoke(this, new ComponentActionEventArgs(this));
 }
예제 #22
0
 public void Click()
 {
     WrappedElement.Click();
     _driver.WaitForPageLoad();
 }
예제 #23
0
 public void Click()
 {
     WaitToBeClickable(By);
     WrappedElement?.Click();
 }
예제 #24
0
 public void ClearFilter() => WrappedElement.Click();
예제 #25
0
 /// <summary>
 ///     Clicks this element.
 /// </summary>
 /// <remarks>
 ///     <para>
 ///         Click this element. If the click causes a new page to load, the
 ///         <see cref="M:OpenQA.Selenium.IWebElement.Click" />
 ///         method will attempt to block until the page has loaded. After calling the.
 ///         <see cref="M:OpenQA.Selenium.IWebElement.Click" /> method, you should discard all references to this.
 ///         element unless you know that the element and the page will still be present.
 ///         Otherwise, any further operations performed on this element will have an undefined.
 ///         behavior.
 ///     </para>
 ///     <para>
 ///         If this element is not clickable, then this operation is ignored. This allows you to.
 ///         simulate a users to accidentally missing the target when clicking.
 ///     </para>
 /// </remarks>
 public void Click()
 {
     Logger.WriteLine(string.Format(CultureInfo.InvariantCulture, "Click element '{0}'", Name));
     WrappedElement.Click();
 }
예제 #26
0
 /// <summary>
 ///     Method to click on button and wait all ajax requests complete.
 /// </summary>
 public void ClickAndWaitAjax()
 {
     Logger.WriteLine(string.Format(CultureInfo.InvariantCulture, "Click the button '{0}'", Name));
     WrappedElement.Click();
     Browser.WaitAjax();
 }
예제 #27
0
 public void Select()
 {
     WrappedElement.Click();
 }
예제 #28
0
 public void Click()
 {
     WrappedElement.Click();
 }
예제 #29
0
 /// <summary>
 ///     Clicks this element.
 /// </summary>
 public void Click()
 {
     NgDriver.WaitForAngular();
     WrappedElement.Click();
 }