コード例 #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);
            }
コード例 #7
0
 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)
     {
     }
 }
コード例 #8
0
        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));
            }
        }
コード例 #9
0
 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;
     }
 }
コード例 #10
0
 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;
     }
 }
コード例 #11
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
     {
         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;
     }
 }
コード例 #16
0
 /// <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);
 }
コード例 #17
0
 /// <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;
   }
 }
コード例 #18
0
        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");
            }
        }
コード例 #19
0
        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
ファイル: Debugger.cs プロジェクト: koreyba/lottosend
 public static void ElementClicked(object sender, WebElementEventArgs e)
 {
     //Console.WriteLine(e.Element + " was clicked ");
 }
コード例 #21
0
ファイル: Debugger.cs プロジェクト: koreyba/lottosend
 public static void ElementClicking(object sender, WebElementEventArgs e)
 {
     //Console.WriteLine("Will click on " + e.Element + "right now ");
 }
コード例 #22
0
 /// <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);
 }
コード例 #23
0
 /// <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);
 }
コード例 #24
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
     {
         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;
     }
 }
コード例 #25
0
 /// <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);
 }
コード例 #26
0
 /// <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);
 }
コード例 #27
0
 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();
     }
 }
コード例 #28
0
 /// <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);
 }
コード例 #29
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;
 }
コード例 #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;
     }
 }
コード例 #31
0
        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);
        }
コード例 #32
0
 void firingDriver_ElementClicked(object sender, WebElementEventArgs e)
 {
     log.AppendLine("Clicked");
 }
コード例 #33
0
 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);
 }
コード例 #35
0
 /// <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);
     }
 }
コード例 #37
0
 /// <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
ファイル: Debugger.cs プロジェクト: koreyba/lottosend
 public static void ElementValueChanging(object sender, WebElementEventArgs e)
 {
     Console.WriteLine("The value of the next element will be changed now: " + e.Element);
 }