private void driver_FoundElement(object sender, FoundElementEventArgs e)
 {
     if (Config.Settings.runTimeSettings.HighlightFoundElements)
     {
         e.Element.Highlight();
     }
 }
예제 #2
0
 private void driver_FoundElement(object sender, FoundElementEventArgs e)
 {
     if (Config.Settings.runTimeSettings.HighlightFoundElements)
     {
         e.Element.Highlight();
     }
 }
예제 #3
0
 void driver_FoundElement(object sender, FoundElementEventArgs e)
 {
     if (Config.Settings.runTimeSettings.HighlightFoundElements)
     {
         e.Element.Highlight(); 
     }
     TestContext.CurrentContext.IncrementAssertCount();
 }
예제 #4
0
 void driver_FoundElement(object sender, FoundElementEventArgs e)
 {
     if (Config.Settings.runTimeSettings.HighlightFoundElements)
     {
         e.Element.Highlight();
     }
     TestContext.CurrentContext.IncrementAssertCount();
 }
 /// <summary>
 /// Raises the <see cref="E:OpenQA.Selenium.Support.Events.EventFiringWebDriver.FindElementCompleted"/> event.
 /// 
 /// </summary>
 /// <param name="e">A <see cref="T:OpenQA.Selenium.Support.Events.FindElementEventArgs"/> that contains the event data.</param>
 protected virtual void OnFoundElement(FoundElementEventArgs e)
 {
     if (this.FoundElement == null)
         return;
     this.FoundElement((object)this, e);
 }
   /// <summary>
 /// Find all <see cref="T:OpenQA.Selenium.IWebElement">IWebElements</see> within the current context
 ///             using the given mechanism.
 /// 
 /// </summary>
 /// <param name="by">The locating mechanism to use.</param>
 /// <returns>
 /// A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1"/> of all <see cref="T:OpenQA.Selenium.IWebElement">WebElements</see>
 ///             matching the current criteria, or an empty list if nothing matches.
 /// </returns>
 public ReadOnlyCollection<IWebElement> FindElements(By by)
 {
   List<IWebElement> list = new List<IWebElement>();
   try
   {
     FindElementEventArgs e = new FindElementEventArgs(this.driver, by);
     this.OnFindingElement(e);
     ReadOnlyCollection<IWebElement> elements = this.driver.FindElements(by);
     this.OnFindElementCompleted(e);
     foreach (IWebElement underlyingElement in elements)
     {
       IWebElement webElement = this.WrapElement(underlyingElement);
       list.Add(webElement);
       FoundElementEventArgs f = new FoundElementEventArgs(driver, underlyingElement, by);
       this.OnFoundElement(f);
     }
   }
   catch (Exception ex)
   {
     this.OnException(new WebDriverExceptionEventArgs(this.driver, ex));
     throw;
   }
   return list.AsReadOnly();
 }
 /// <summary>
 /// Find the first <see cref="T:OpenQA.Selenium.IWebElement"/> using the given method.
 /// 
 /// </summary>
 /// <param name="by">The locating mechanism to use.</param>
 /// <returns>
 /// The first matching <see cref="T:OpenQA.Selenium.IWebElement"/> on the current context.
 /// </returns>
 /// <exception cref="T:OpenQA.Selenium.NoSuchElementException">If no element matches the criteria.</exception>
 public IWebElement FindElement(By by)
 {
   try
   {
     FindElementEventArgs e = new FindElementEventArgs(this.driver, by);
     this.OnFindingElement(e);
     IWebElement element = this.driver.FindElement(by);
     this.OnFindElementCompleted(e);
     FoundElementEventArgs f= new FoundElementEventArgs(driver,element,by);
     this.OnFoundElement(f);
     return this.WrapElement(element);
   }
   catch (Exception ex)
   {
     this.OnException(new WebDriverExceptionEventArgs(this.driver, ex));
     throw;
   }
 }
 /// <summary>
 ///     Raises the <see cref="E:OpenQA.Selenium.Support.Events.EventFiringWebDriver.FindElementCompleted" /> event.
 /// </summary>
 /// <param name="e">A <see cref="T:OpenQA.Selenium.Support.Events.FindElementEventArgs" /> that contains the event data.</param>
 protected virtual void OnFoundElement(FoundElementEventArgs e)
 {
     if (FoundElement == null)
         return;
     FoundElement(this, e);
 }
 /// <summary>
 ///     Find all <see cref="T:OpenQA.Selenium.IWebElement">IWebElements</see> within the current context
 ///     using the given mechanism.
 /// </summary>
 /// <param name="by">The locating mechanism to use.</param>
 /// <returns>
 ///     A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of all
 ///     <see cref="T:OpenQA.Selenium.IWebElement">WebElements</see>
 ///     matching the current criteria, or an empty list if nothing matches.
 /// </returns>
 public ReadOnlyCollection<IWebElement> FindElements(By by)
 {
     var list = new List<IWebElement>();
     try
     {
         var e = new FindElementEventArgs(WrappedDriver, by);
         OnFindingElement(e);
         var elements = WrappedDriver.FindElements(by).Where(x => x.Displayed);
         OnFindElementCompleted(e);
         foreach (var underlyingElement in elements)
         {
             var webElement = WrapElement(underlyingElement);
             list.Add(webElement);
             var f = new FoundElementEventArgs(WrappedDriver, underlyingElement, by);
             OnFoundElement(f);
         }
     }
     catch (Exception ex)
     {
         OnException(new WebDriverExceptionEventArgs(WrappedDriver, ex));
         throw;
     }
     return list.AsReadOnly();
 }
 /// <summary>
 ///     Find the first <see cref="T:OpenQA.Selenium.IWebElement" /> using the given method.
 /// </summary>
 /// <param name="by">The locating mechanism to use.</param>
 /// <returns>
 ///     The first matching <see cref="T:OpenQA.Selenium.IWebElement" /> on the current context.
 /// </returns>
 /// <exception cref="T:OpenQA.Selenium.NoSuchElementException">If no element matches the criteria.</exception>
 public IWebElement FindElement(By by)
 {
     try
     {
         var e = new FindElementEventArgs(WrappedDriver, by);
         OnFindingElement(e);
         var element = WrappedDriver.FindElements(by).FirstOrDefault(x => x.Displayed);
         OnFindElementCompleted(e);
         var f = new FoundElementEventArgs(WrappedDriver, element, by);
         OnFoundElement(f);
         return WrapElement(element);
     }
     catch (Exception ex)
     {
         OnException(new WebDriverExceptionEventArgs(WrappedDriver, ex));
         throw;
     }
 }
 /// <summary>
 ///     Finds the first element in the page that matches the <see cref="T:OpenQA.Selenium.By" /> object
 /// </summary>
 /// <param name="by">By mechanism to find the element</param>
 /// <returns>
 ///     IWebElement object so that you can interaction that object
 /// </returns>
 public IWebElement FindElement(By by)
 {
     try
     {
         var e = new FindElementEventArgs(ParentDriver.WrappedDriver, WrappedElement, by);
         ParentDriver.OnFindingElement(e);
         var element = WrappedElement.FindElement(by);
         ParentDriver.OnFindElementCompleted(e);
         var f = new FoundElementEventArgs(ParentDriver.WrappedDriver, element, by);
         ParentDriver.OnFoundElement(f);
         return ParentDriver.WrapElement(element);
     }
     catch (Exception ex)
     {
         ParentDriver.OnException(new WebDriverExceptionEventArgs(ParentDriver, ex));
         throw;
     }
 }
예제 #12
0
 void driver_FoundElement(object sender, FoundElementEventArgs e)
 {
 }