Beispiel #1
0
 public static void SelectControlInBrowserByCustom(IE ie, string strCustomAttribute, string strToFind,
                                                   Enumerators.ControlType ctrl)
 {
     if (ctrl == Enumerators.ControlType.Image)
     {
         Image imgCtrl =
             (Image)FindControlInBrowserByCustom(ie, strCustomAttribute, strToFind, Enumerators.ControlType.Image);
         imgCtrl.Click();
     }
     else if (ctrl == Enumerators.ControlType.TableCell)
     {
         TableCell tblCell =
             (TableCell)FindControlInBrowserByCustom(ie, strCustomAttribute, strToFind, Enumerators.ControlType.TableCell);
         tblCell.Click();
     }
     else if (ctrl == Enumerators.ControlType.Link)
     {
         Link lnkToSelect =
             (Link)FindControlInBrowserByCustom(ie, strCustomAttribute, strToFind, Enumerators.ControlType.Link);
         lnkToSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.CheckBox)
     {
         CheckBox chkToClick =
             (CheckBox)FindControlInBrowserByCustom(ie, strCustomAttribute, strToFind, Enumerators.ControlType.CheckBox);
         chkToClick.Click();
     }
     else if (ctrl == Enumerators.ControlType.Div)
     {
         Div divToClick = (Div)FindControlInBrowserByCustom(ie, strCustomAttribute, strToFind, Enumerators.ControlType.Div);
         divToClick.Click();
     }
     ie.WaitForComplete();
 }
Beispiel #2
0
        public static void GetNewAccount(out string Account, out string Password)
        {
            // Windows
            WatiN.Core.IE window = new WatiN.Core.IE("http://www.forexmicrolot.com/open-free-micro-uk.jsp");

            // Frames

            // Model
            var        frame       = ((WatiN.Core.Document)(window)).Frames[0];
            TextField  txt_FNAME   = frame.TextField(Find.ByName("FNAME"));
            TextField  txt_LNAME   = frame.TextField(Find.ByName("LNAME"));
            TableCell  td_         = frame.TableCell(Find.ByText(""));
            SelectList sel_COUNTRY = frame.SelectList(Find.ByName("COUNTRY"));
            TextField  txt_EMAIL   = frame.TextField(Find.ByName("EMAIL"));
            Image      img_submit  = frame.Image(Find.ByName("submit"));

            // Code
            txt_FNAME.Click();
            txt_FNAME.TypeText("a");
            txt_LNAME.Click();
            txt_LNAME.TypeText("a");
            td_.Click();
            sel_COUNTRY.SelectByValue("Afghanistan");
            txt_EMAIL.Click();
            txt_EMAIL.TypeText("*****@*****.**");
            td_.Click();
            img_submit.Click();
            window.WaitForComplete();
            frame = ((WatiN.Core.Document)(window)).Frames[0];
            var TD = frame.TableCell(td => td.Text == "User ID");

            Account  = TD.ContainingTableRow.OwnTableCells[2].Text;
            TD       = frame.TableCell(td => td.Text == "Password");
            Password = TD.ContainingTableRow.OwnTableCells[2].Text;
            window.Dispose();
        }
Beispiel #3
0
 public static void SelectControlInBrowserByID(IE ie, string strID, Enumerators.ControlType ctrl)
 {
     if (ctrl == Enumerators.ControlType.Image)
     {
         Image imgCtrl = (Image)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Image);
         imgCtrl.Click();
     }
     else if (ctrl == Enumerators.ControlType.TableCell)
     {
         TableCell tblCell = (TableCell)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.TableCell);
         tblCell.Click();
     }
     else if (ctrl == Enumerators.ControlType.Button)
     {
         Button btnToSelect = (Button)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Button);
         btnToSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.Link)
     {
         Link lnkSelect = (Link)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Link);
         lnkSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.CheckBox)
     {
         CheckBox chkToSelect = (CheckBox)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.CheckBox);
         chkToSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.Div)
     {
         Div divToSelect = (Div)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Div);
         divToSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.Span)
     {
         Span spanToSelect = (Span)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Span);
         spanToSelect.Click();
     }
     ie.WaitForComplete();
 }