예제 #1
0
 /// <summary>
 /// Check if element is present on page or not
 /// </summary>
 /// <param name="how"></param>
 /// <param name="elementName"></param>
 /// <returns></returns>
 public bool IsElementPresent(DriverUtilities.ElementAccessorType how, string elementName)
 {
     try
     {
         _driverUtils.IsElementPresent(how, elementName);
         return(true);
     }
     catch (NoSuchElementException)
     {
         Console.WriteLine("Element: {0} does not exist.", elementName);
         return(false);
     }
 }
예제 #2
0
 /// <summary>
 /// Get the displayed text
 /// </summary>
 /// <param name="how"></param>
 /// <param name="elementName"></param>
 /// <returns>String</returns>
 public string GetText(DriverUtilities.ElementAccessorType how, string elementName)
 {
     try
     {
         string text = _driverUtils.GetText(how, elementName);
         return(text == null ? string.Empty : text);         // return empty string instead of null
     }
     catch (Exception e)
     {
         _resultString.Append(e.Message);
         return(_resultString.ToString());
     }
 }
예제 #3
0
        /// <summary>
        /// Click on an element.
        /// </summary>
        /// <param name="how"></param>
        /// <param name="elementName"></param>
        public string Click(DriverUtilities.ElementAccessorType how, string elementName)
        {
            _resultString.Clear();

            try
            {
                _driverUtils.Click(how, elementName);
            }
            catch (Exception e)
            {
                _resultString.Append(e.Message);
            }

            return(_resultString.ToString());
        }
예제 #4
0
        /// <summary>
        /// Sets an explicit wait time in seconds.
        /// </summary>
        /// <param name="driver"></param>
        /// <param name="seconds"></param>
        /// <param name="elementName"></param>
        public string ExplicitWait(DriverUtilities.ElementAccessorType how, string elementName, double seconds)
        {
            _resultString.Clear();

            try
            {
                _driverUtils.ExplicitWait(how, elementName, seconds);
            }
            catch (Exception e)
            {
                _resultString.Append(e.Message);
            }

            return(_resultString.ToString());
        }