Ejemplo n.º 1
0
 /// <summary>
 /// Click Action Wrapper Method
 /// </summary>
 /// <param name="element">IWebElement Object</param>
 /// <param name="report">TestReporting Object</param>
 /// <param name="elementName">Web Element Name</param>
 public static void Click(this IWebElement element, TestReporting report, string elementName)
 {
     if (element.Displayed && element.Enabled)
     {
         element.Click();
         report.SetStepStatusPass($"Clicked on the element [{elementName}].");
     }
     else
     {
         report.SetStepStatusError($"Element [{elementName}] is not displayed");
         throw new Exception($"Element [{elementName}] is not displayed");
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Launch - GoToUrl Wrapper Method
 /// </summary>
 /// <param name="driver">IWebDriver Object</param>
 /// <param name="report">TestReporting Object</param>
 /// <param name="url">Web URL String</param>
 public static void LaunchUrl(this IWebDriver driver, TestReporting report, string url)
 {
     try
     {
         driver.Navigate().GoToUrl(url);
         report.SetStepStatusPass($"URL [{url}] launched successfully.");
     }
     catch (Exception e)
     {
         report.SetStepStatusError(e.Message);
         throw new Exception(e.Message);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// SendKeys Action Wrapper Method
 /// </summary>
 /// <param name="element">IWebElement Object</param>
 /// <param name="report">TestReporting Object</param>
 /// <param name="value">Ttext Input Value String</param>
 /// <param name="elementName">Web Element Name</param>
 public static void SendKeys(this IWebElement element, TestReporting report, string value, string elementName)
 {
     try
     {
         element.SendKeys(value);
         report.SetStepStatusPass($"SendKeys value [{value}] to  element [{elementName}].");
     }
     catch (Exception e)
     {
         report.SetStepStatusError(e.Message);
         throw new Exception(e.Message);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Clear Action Wrapper Method
        /// </summary>
        /// <param name="element">IWebElement Object</param>
        /// <param name="report">TestReporting Object</param>
        /// <param name="elementName">Web Element Name</param>
        public static void Clear(this IWebElement element, TestReporting report, string elementName)
        {
            element.Clear();

            if (element.Text.Equals(string.Empty))
            {
                report.SetStepStatusPass($"Cleared element [{elementName}] content.");
            }
            else
            {
                report.SetStepStatusError($"Element [{elementName}] content is not cleared. Element value is [{element.Text}]");
                throw new Exception($"Element [{elementName}] content is not cleared.");
            }
        }