Exemple #1
0
 public static bool hasButton(this WatiN_IE watinIe, string nameOrId)
 {
     foreach (var button in watinIe.buttons())
     {
         if (button.id() == nameOrId || button.value() == nameOrId)
         {
             return(true);
         }
     }
     return(false);
     //return watinIe.buttons().ids().Contains(id);
 }
 /// <summary>
 /// Finds a button based on the provided searchText (which is normalized to lowercase and trimmed),
 /// using the folowing search sequence (of html attributes):
 ///    - name
 ///    - id
 ///    - value
 ///    - className
 /// </summary>
 /// <param name="watinIe"></param>
 /// <param name="searchText"></param>
 /// <returns></returns>
 public static WatiN.Core.Button button(this WatiN_IE watinIe, string searchText)
 {
     searchText = searchText.trim().lower();
     if (searchText.valid())
     {
         foreach (var button in watinIe.buttons())
         {
             if ((button.name().lower() == searchText) ||
                 (button.id().lower() == searchText) ||
                 (button.value().lower() == searchText) ||
                 (button.className().lower() == searchText))
             {
                 return(button);
             }
         }
         "in WatiN_IE could not find Button with provided searchText (searched on name, id, value and classname ):{0}".error(searchText);
     }
     return(null);
 }
Exemple #3
0
 public static WatiN.Core.Button button(this WatiN_IE watinIe, string identifier)
 {
     identifier = identifier.trim();
     if (identifier.valid())
     {
         identifier = identifier.trim();
         foreach (var button in watinIe.buttons())
         {
             if ((button.id().notNull() && button.id().trim() == identifier) ||
                 (button.value().notNull() && button.value().trim() == identifier) ||
                 (button.className().notNull() && button.className().trim() == identifier) ||
                 (button.outerText().notNull() && button.outerText().trim() == identifier))
             {
                 return(button);
             }
         }
     }
     "in WatiN_IE could not find Button with identifier (searched on id,name, classname and outerText):{0}".error(identifier ?? "[null value]");
     return(null);
 }