示例#1
0
 /// <summary>
 /// Raises the <see cref="ElementClicked"/> event.
 /// </summary>
 /// <param name="e">A <see cref="WebElementEventArgs"/> that contains the event data.</param>
 protected virtual void OnElementClicked(WebElementEventArgs e)
 {
     if (this.ElementClicked != null)
     {
         this.ElementClicked(this, e);
     }
 }
示例#2
0
 /// <summary>
 /// Raises the <see cref="ElementValueChanged"/> event.
 /// </summary>
 /// <param name="e">A <see cref="WebElementEventArgs"/> that contains the event data.</param>
 protected virtual void OnElementValueChanged(WebElementEventArgs e)
 {
     if (this.ElementValueChanged != null)
     {
         this.ElementValueChanged(this, e);
     }
 }
示例#3
0
            /// <summary>
            /// Method for sending native key strokes to the browser
            /// </summary>
            /// <param name="text">String containing what you would like to type onto the screen</param>
            public void SendKeys(string text)
            {
                WebElementEventArgs e = new WebElementEventArgs(this.parentDriver.WrappedDriver, this.underlyingElement);

                this.parentDriver.OnElementValueChanging(e);
                this.underlyingElement.SendKeys(text);
                this.parentDriver.OnElementValueChanged(e);
            }
示例#4
0
            /// <summary>
            /// Click this element. If this causes a new page to load, this method will block until the page has loaded. At this point, you should discard all references to this element and any further operations performed on this element
            /// will have undefined behaviour unless you know that the element and the page will still be present. If this element is not clickable, then this operation is a no-op since it's pretty common for someone to accidentally miss
            /// the target when clicking in Real Life
            /// </summary>
            public void Click()
            {
                WebElementEventArgs e = new WebElementEventArgs(this.parentDriver.WrappedDriver, this.underlyingElement);

                this.parentDriver.OnElementClicking(e);
                this.underlyingElement.Click();
                this.parentDriver.OnElementClicked(e);
            }
示例#5
0
            /// <summary>
            /// Method to clear the text out of an Input element
            /// </summary>
            public void Clear()
            {
                WebElementEventArgs e = new WebElementEventArgs(this.parentDriver.WrappedDriver, this.underlyingElement);

                this.parentDriver.OnElementValueChanging(e);
                this.underlyingElement.Clear();
                this.parentDriver.OnElementValueChanged(e);
            }
示例#6
0
            public bool Toggle()
            {
                WebElementEventArgs e = new WebElementEventArgs(this.parentDriver.WrappedDriver, this.underlyingElement);

                this.parentDriver.OnElementValueChanging(e);
                bool toggleValue = this.underlyingElement.Toggle();

                this.parentDriver.OnElementValueChanged(e);
                return(toggleValue);
            }
 private void driver_ElementValueChanged(object sender, WebElementEventArgs e)
 {
     try
     {
         if (Config.Settings.reportSettings.commandLogging)
         {
             TestBase.LogEvent(GetLogMessage("Typing", e, e.Element.GetAttribute("value")));
         }
     }
     catch (Exception)
     {
     }
 }
        private void driver_ElementClicking(object sender, WebElementEventArgs e)
        {
            Common.Delay(Config.Settings.runTimeSettings.CommandDelayMs);
            if (Config.Settings.reportSettings.commandLogging)
            {
                TestBase.LogEvent(GetLogMessage("Click", e));
            }

            if (e.Element == null)
            {
                throw new NoSuchElementException(string.Format("Element '{0}' not present, cannot click on it",
                    e.Element));
            }
        }
 public void SendKeys(string text)
 {
     try
     {
         WebElementEventArgs e = new WebElementEventArgs(this.parentDriver.WrappedDriver, this.underlyingElement);
         this.parentDriver.OnElementValueChanging(e);
         this.underlyingElement.SendKeys(text);
         this.parentDriver.OnElementValueChanged(e);
     }
     catch (Exception thrownException)
     {
         this.parentDriver.OnException(new WebDriverExceptionEventArgs(this.parentDriver, thrownException));
         throw;
     }
 }
 public void Click()
 {
     try
     {
         WebElementEventArgs e = new WebElementEventArgs(this.parentDriver.WrappedDriver, this.underlyingElement);
         this.parentDriver.OnElementClicking(e);
         this.underlyingElement.Click();
         this.parentDriver.OnElementClicked(e);
     }
     catch (Exception thrownException)
     {
         this.parentDriver.OnException(new WebDriverExceptionEventArgs(this.parentDriver, thrownException));
         throw;
     }
 }
 /// <summary>
 ///     Method for sending native key strokes to the browser
 /// </summary>
 /// <param name="text">String containing what you would like to type onto the screen</param>
 public void SendKeys(string text)
 {
     try
     {
         var e = new WebElementEventArgs(ParentDriver.WrappedDriver, WrappedElement);
         ParentDriver.OnElementValueChanging(e);
         WrappedElement.SendKeys(text);
         ParentDriver.OnElementValueChanged(e);
     }
     catch (Exception ex)
     {
         ParentDriver.OnException(new WebDriverExceptionEventArgs(ParentDriver, ex));
         throw;
     }
 }
示例#12
0
 /// <summary>
 /// Raises the <see cref="ElementValueChanging"/> event.
 /// </summary>
 /// <param name="e">A <see cref="WebElementEventArgs"/> that contains the event data.</param>
 protected virtual void OnElementValueChanging(WebElementEventArgs e)
 {
     if (this.ElementValueChanging != null)
     {
         this.ElementValueChanging(this, e);
     }
 }
示例#13
0
 /// <summary>
 /// Method for sending native key strokes to the browser
 /// </summary>
 /// <param name="text">String containing what you would like to type onto the screen</param>
 public void SendKeys(string text)
 {
     WebElementEventArgs e = new WebElementEventArgs(this.parentDriver.WrappedDriver, this.underlyingElement);
     this.parentDriver.OnElementValueChanging(e);
     this.underlyingElement.SendKeys(text);
     this.parentDriver.OnElementValueChanged(e);
 }
示例#14
0
 /// <summary>
 /// Method to clear the text out of an Input element
 /// </summary>
 public void Clear()
 {
     WebElementEventArgs e = new WebElementEventArgs(this.parentDriver.WrappedDriver, this.underlyingElement);
     this.parentDriver.OnElementValueChanging(e);
     this.underlyingElement.Clear();
     this.parentDriver.OnElementValueChanged(e);
 }
示例#15
0
 /// <summary>
 /// Click this element. If this causes a new page to load, this method will block until 
 /// the page has loaded. At this point, you should discard all references to this element 
 /// and any further operations performed on this element will have undefined behavior unless
 /// you know that the element and the page will still be present. If this element is not 
 /// clickable, then this operation is a no-op since it's pretty common for someone to 
 /// accidentally miss  the target when clicking in Real Life
 /// </summary>
 public void Click()
 {
     try
     {
         WebElementEventArgs e = new WebElementEventArgs(this.parentDriver.WrappedDriver, this.underlyingElement);
         this.parentDriver.OnElementClicking(e);
         this.underlyingElement.Click();
         this.parentDriver.OnElementClicked(e);
     }
     catch (Exception ex)
     {
         this.parentDriver.OnException(new WebDriverExceptionEventArgs(this.parentDriver, ex));
         throw;
     }
 }
 /// <summary>
 /// Raises the <see cref="E:OpenQA.Selenium.Support.Events.EventFiringWebDriver.ElementValueChanged"/> event.
 /// 
 /// </summary>
 /// <param name="e">A <see cref="T:OpenQA.Selenium.Support.Events.WebElementEventArgs"/> that contains the event data.</param>
 protected virtual void OnElementValueChanged(WebElementEventArgs e)
 {
   if (this.ElementValueChanged == null)
     return;
   this.ElementValueChanged((object) this, e);
 }
 /// <summary>
 /// Method to clear the text out of an Input element
 /// 
 /// </summary>
 public void Clear()
 {
   try
   {
     WebElementEventArgs e = new WebElementEventArgs(this.parentDriver.WrappedDriver, this.underlyingElement);
     this.parentDriver.OnElementValueChanging(e);
     this.underlyingElement.Clear();
     this.parentDriver.OnElementValueChanged(e);
   }
   catch (Exception ex)
   {
     this.parentDriver.OnException(new WebDriverExceptionEventArgs((IWebDriver) this.parentDriver, ex));
     throw;
   }
 }
        private void OnElementValueChanging(object sender, WebElementEventArgs webElementEventArgs)
        {
            SeleniumLog log = SeleniumLog.Instance();
            if (log.Config.OnChangeValue_LogBeforeEvent)
            {
                log.SaveIndent("OnElementValueChanging");
                //int level = log.PendingIndentLevel;
                log.Indent();
                log.WriteLine("[Selenium Event]  Changing value ...");

                if (!string.IsNullOrEmpty(_keyInput))
                {
                    log.WriteLine(" [" + _keyInput + "]", take_screenshot: log.Config.OnChangeValue_TakeScreenshotBeforeEvent);
                }
                log.RestoreIndent("OnElementValueChanging");
            }
        }
        private void OnElementValueChanged(object sender, WebElementEventArgs webElementEventArgs)
        {
            SeleniumLog log = SeleniumLog.Instance();
            if (log.Config.OnChangeValue_LogAfterEvent)
            {
                log.SaveIndent("OnElementValueChanged");
                log.Indent();
                log.WriteLine("[Selenium Event]  Successfully changed value [" + webElementEventArgs.Element.GetAttribute("value") + "]", take_screenshot: log.Config.OnChangeValue_TakeScreenshotAfterEvent);
                log.Indent();

                if (!string.IsNullOrEmpty(_keyInput))
                {
                    //log.WriteLine("Input was: " + _keyInput);
                }
                log.RestoreIndent("OnElementValueChanged");
            }
        }
示例#20
0
 public static void ElementClicked(object sender, WebElementEventArgs e)
 {
     //Console.WriteLine(e.Element + " was clicked ");
 }
示例#21
0
 public static void ElementClicking(object sender, WebElementEventArgs e)
 {
     //Console.WriteLine("Will click on " + e.Element + "right now ");
 }
 /// <summary>
 ///     Raises the <see cref="E:OpenQA.Selenium.Support.Events.EventFiringWebDriver.ElementValueChanging" /> event.
 /// </summary>
 /// <param name="e">A <see cref="T:OpenQA.Selenium.Support.Events.WebElementEventArgs" /> that contains the event data.</param>
 protected virtual void OnElementValueChanging(WebElementEventArgs e)
 {
     if (ElementValueChanging == null)
         return;
     ElementValueChanging(this, e);
 }
 /// <summary>
 ///     Raises the <see cref="E:OpenQA.Selenium.Support.Events.EventFiringWebDriver.ElementClicked" /> event.
 /// </summary>
 /// <param name="e">A <see cref="T:OpenQA.Selenium.Support.Events.WebElementEventArgs" /> that contains the event data.</param>
 protected virtual void OnElementClicked(WebElementEventArgs e)
 {
     if (ElementClicked == null)
         return;
     ElementClicked(this, e);
 }
 /// <summary>
 ///     Click this element. If this causes a new page to load, this method will block until
 ///     the page has loaded. At this point, you should discard all references to this element
 ///     and any further operations performed on this element will have undefined behavior unless
 ///     you know that the element and the page will still be present. If this element is not
 ///     clickable, then this operation is a no-op since it's pretty common for someone to
 ///     accidentally miss  the target when clicking in Real Life
 /// </summary>
 public void Click()
 {
     try
     {
         var e = new WebElementEventArgs(ParentDriver.WrappedDriver, WrappedElement);
         ParentDriver.OnElementClicking(e);
         WrappedElement.Click();
         ParentDriver.OnElementClicked(e);
     }
     catch (Exception ex)
     {
         ParentDriver.OnException(new WebDriverExceptionEventArgs(ParentDriver, ex));
         throw;
     }
 }
 /// <summary>
 /// Raises the <see cref="E:ElementClicking" /> event.
 /// </summary>
 /// <param name="e">The <see cref="WebElementEventArgs"/> instance containing the event data.</param>
 protected override void OnElementClicking(WebElementEventArgs e)
 {
     Logger.Trace(CultureInfo.CurrentCulture, "Clicking: {0}", ToStringElement(e));
     base.OnElementClicking(e);
 }
 /// <summary>
 /// Raises the <see cref="E:ElementValueChanged" /> event.
 /// </summary>
 /// <param name="e">The <see cref="WebElementEventArgs"/> instance containing the event data.</param>
 protected override void OnElementValueChanged(WebElementEventArgs e)
 {
     Logger.Trace(CultureInfo.CurrentCulture, "On Element Value Changed: {0}", ToStringElement(e));
     base.OnElementValueChanged(e);
 }
 private void OnElementClicked(object sender, WebElementEventArgs webElementEventArgs)
 {
     //Console.WriteLine("ElementClicked: " + webElementEventArgs.Element);
     SeleniumLog log = SeleniumLog.Instance();
     if (log.Config.OnClick_LogAfterEvent)
     {
         log.Indent();
         log.WriteLine("[Selenium Event]  Click Success!", take_screenshot: log.Config.OnClick_TakeScreenshotAfterEvent);
         log.Unindent();
     }
 }
 /// <summary>
 /// Raises the <see cref="E:OpenQA.Selenium.Support.Events.EventFiringWebDriver.ElementClicking"/> event.
 /// 
 /// </summary>
 /// <param name="e">A <see cref="T:OpenQA.Selenium.Support.Events.WebElementEventArgs"/> that contains the event data.</param>
 protected virtual void OnElementClicking(WebElementEventArgs e)
 {
   if (this.ElementClicking == null)
     return;
   this.ElementClicking((object) this, e);
 }
 public bool Toggle()
 {
     WebElementEventArgs e = new WebElementEventArgs(this.parentDriver.WrappedDriver, this.underlyingElement);
     this.parentDriver.OnElementValueChanging(e);
     bool toggleValue = this.underlyingElement.Toggle();
     this.parentDriver.OnElementValueChanged(e);
     return toggleValue;
 }
示例#30
0
 /// <summary>
 /// Method for sending native key strokes to the browser
 /// </summary>
 /// <param name="text">String containing what you would like to type onto the screen</param>
 public void SendKeys(string text)
 {
     try
     {
         WebElementEventArgs e = new WebElementEventArgs(this.parentDriver.WrappedDriver, this.underlyingElement);
         this.parentDriver.OnElementValueChanging(e);
         this.underlyingElement.SendKeys(text);
         this.parentDriver.OnElementValueChanged(e);
     }
     catch (Exception ex)
     {
         this.parentDriver.OnException(new WebDriverExceptionEventArgs(this.parentDriver, ex));
         throw;
     }
 }
        private string GetLogMessage(string command, WebElementEventArgs e = null, string param = "")
        {
            if (param != "") param = "'" + param + "'";

            if (TestBase.testData.lastElement.name != "Element")
            {
                return string.Format(errorMessage, TestBase.GetCurrentClassAndMethodName(), command, TestBase.testData.lastElement.name, e.Element.GetHtml(60), param);
            }

            return string.Format(errorMessage, TestBase.GetCurrentClassAndMethodName(), command, "Element", e.Element.GetHtml(60),param);
        }
 void firingDriver_ElementClicked(object sender, WebElementEventArgs e)
 {
     log.AppendLine("Clicked");
 }
 private void OnElementClicking(object sender, WebElementEventArgs webElementEventArgs)
 { 
     SeleniumLog log = SeleniumLog.Instance();
     if (log.Config.OnClick_LogBeforeEvent)
     {
         log.Indent();
         log.WriteLine("[Selenium Event]  Clicking Element: " + _by + " " + _locator, take_screenshot: log.Config.OnClick_TakeScreenshotBeforeEvent);
         log.Unindent();
     }
 }
示例#34
0
 /// <summary>
 /// Click this element. If this causes a new page to load, this method will block until the page has loaded. At this point, you should discard all references to this element and any further operations performed on this element 
 /// will have undefined behaviour unless you know that the element and the page will still be present. If this element is not clickable, then this operation is a no-op since it's pretty common for someone to accidentally miss 
 /// the target when clicking in Real Life
 /// </summary>
 public void Click()
 {
     WebElementEventArgs e = new WebElementEventArgs(this.parentDriver.WrappedDriver, this.underlyingElement);
     this.parentDriver.OnElementClicking(e);
     this.underlyingElement.Click();
     this.parentDriver.OnElementClicked(e);
 }
 /// <summary>
 /// To the string element.
 /// </summary>
 /// <param name="e">The <see cref="WebElementEventArgs"/> instance containing the event data.</param>
 /// <returns>Formated issue</returns>
 private static string ToStringElement(WebElementEventArgs e)
 {
     return string.Format(
         CultureInfo.CurrentCulture,
         "{0}{{{1}{2}{3}{4}{5}{6}{7}{8}}}",
         e.Element.TagName,
         AppendAttribute(e, "id"),
         AppendAttribute(e, "name"),
         AppendAttribute(e, "value"),
         AppendAttribute(e, "class"),
         AppendAttribute(e, "type"),
         AppendAttribute(e, "role"),
         AppendAttribute(e, "text"),
         AppendAttribute(e, "href"));
 }
示例#36
0
 /// <summary>
 /// Raises the <see cref="ElementClicking"/> event.
 /// </summary>
 /// <param name="e">A <see cref="WebElementEventArgs"/> that contains the event data.</param>
 protected virtual void OnElementClicking(WebElementEventArgs e)
 {
     if (this.ElementClicking != null)
     {
         this.ElementClicking(this, e);
     }
 }
 /// <summary>
 /// Appends the attribute.
 /// </summary>
 /// <param name="e">The <see cref="WebElementEventArgs"/> instance containing the event data.</param>
 /// <param name="attribute">The attribute.</param>
 /// <returns>Atribute and value</returns>
 private static string AppendAttribute(WebElementEventArgs e, string attribute)
 {
     var attrValue = attribute == "text" ? e.Element.Text : e.Element.GetAttribute(attribute);
     return string.IsNullOrEmpty(attrValue) ? string.Empty : string.Format(CultureInfo.CurrentCulture, " {0}='{1}' ", attribute, attrValue);
 }
示例#38
0
 void firingDriver_ElementClicked(object sender, WebElementEventArgs e)
 {
     log.AppendLine("Clicked");
 }
示例#39
0
 public static void ElementValueChanging(object sender, WebElementEventArgs e)
 {
     Console.WriteLine("The value of the next element will be changed now: " + e.Element);
 }