public void Select() { if (!Selected) { WrappedElement.Click(); } }
public void Deselect() { if (Selected) { WrappedElement.Click(); } }
public void Check(bool isChecked = true) { if (isChecked && !WrappedElement.Selected || !isChecked && WrappedElement.Selected) { WrappedElement.Click(); } }
/// <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); }
/// <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(); } }
/// <summary> /// The deselect. /// </summary> public virtual void Deselect() { if (Selected) { Logger.WriteLine(string.Format(CultureInfo.InvariantCulture, "Uncheck the checkbox '{0}'", Name)); WrappedElement.Click(); } }
internal void Click(EventHandler <ElementActionEventArgs> clicking, EventHandler <ElementActionEventArgs> clicked) { clicking?.Invoke(this, new ElementActionEventArgs(this)); WrappedElement.Click(); clicked?.Invoke(this, new ElementActionEventArgs(this)); }
public UpWebElement Click() { UpDriver.WaitForPageReady(); Log.GetLogger().Info($"Clicking element [{ElementIdentifier}]"); WrappedElement.Click(); return(this); }
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)); }
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))); }
private void DisplayCalendar() { if (IsPopup && !CalendarContainerElement.Displayed) { WrappedElement.Click(); WrappedDriver.Wait(datePickerComponentOptions.AnimationDuration) .Until(d => CalendarContainerElement.Displayed); } }
/// <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(); } }
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)); }
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); } }
/// <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); }
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); } }
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)); }
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); } }
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)); }
public void Click() { Clicking?.Invoke(this, new ComponentActionEventArgs(this)); WrappedElement.Click(); Clicked?.Invoke(this, new ComponentActionEventArgs(this)); }
public void Click() { WrappedElement.Click(); _driver.WaitForPageLoad(); }
public void Click() { WaitToBeClickable(By); WrappedElement?.Click(); }
public void ClearFilter() => WrappedElement.Click();
/// <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(); }
/// <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(); }
public void Select() { WrappedElement.Click(); }
public void Click() { WrappedElement.Click(); }
/// <summary> /// Clicks this element. /// </summary> public void Click() { NgDriver.WaitForAngular(); WrappedElement.Click(); }