Exemple #1
0
 public static IWebElement GetWebElementByName(this SeleniqBaseElement element, string name)
 {
     foreach (var property in element.GetType().GetProperties())
     {
         if (!property.PropertyType.Name.Equals(nameof(IWebElement)))
         {
             continue;
         }
         if (property.Name.Equals(name))
         {
             try
             {
                 return(property.GetValue(element) as IWebElement);
             }
             catch (TargetInvocationException e)
             {
                 if (e.InnerException != null)
                 {
                     throw new NoSuchElementException($"Unable to locate {name} on {element.GetType().Name}");
                 }
             }
         }
     }
     throw new SeleniqException($"Unable to find {name} IWebElement");
 }
        public static SeleniqBaseElement ValidateExists(this SeleniqBaseElement element)
        {
            var text = $"Validating presence of {element.GetType().Name}";

            AllureLifecycle.Instance.WrapInStep(() =>
            {
                Console.WriteLine(text);
                Assert.IsNotNull(element);
            }, text);
            return(element);
        }