当前位置: 首页>>代码示例>>C#>>正文


C# Browser.Element方法代码示例

本文整理汇总了C#中Browser.Element方法的典型用法代码示例。如果您正苦于以下问题:C# Browser.Element方法的具体用法?C# Browser.Element怎么用?C# Browser.Element使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Browser的用法示例。


在下文中一共展示了Browser.Element方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ISEFilterBy

        /// <summary>
        /// Method to Filter the Integrated System Errors
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="selection">Column Name</param>
        /// <param name="searchstring">Column Value</param>
        /// <param name="filterby">Filter Selection ie Begins With</param>
        public void ISEFilterBy(Browser browser, string selection, string searchstring,  string filterby)
        {
            ImageCollection filters = browser.Images.Filter(Find.ByClass("dxGridView_gvFilterRowButton"));
            switch (selection)
            {

               case "IntSys":

                    filters[0].Click();
                    browser.Element(Find.ByText(filterby)).Click();
                    browser.TextField(Find.ById(new Regex("ctl00_MainContent_rpIntegrationSystemErrors_gvIntegrationSystemErrors_DXFREditorcol1_I"))).TypeText(searchstring);
                    break;

               case "IntSysDesc":

                    filters[1].Click();
                    browser.Element(Find.ByText(filterby)).Click();
                    browser.TextField(Find.ById(new Regex("ctl00_MainContent_rpIntegrationSystemErrors_gvIntegrationSystemErrors_DXFREditorcol2_I"))).TypeText(searchstring);
                    break;

               case "ErrDesc":

                    filters[2].Click();
                    browser.Element(Find.ByText(filterby)).Click();
                    browser.TextField(Find.ById(new Regex("ctl00_MainContent_rpIntegrationSystemErrors_gvIntegrationSystemErrors_DXFREditorcol3_I"))).TypeText(searchstring);
                    break;

                case "Resolved":

                    filters[3].Click();
                    browser.Element(Find.ByText(filterby)).Click();
                    browser.TextField(Find.ById(new Regex("ctl00_MainContent_rpIntegrationSystemErrors_gvIntegrationSystemErrors_DXFREditorcol4_I"))).TypeText(searchstring);
                    break;

                case "AddDt":

                    filters[4].Click();
                    browser.Element(Find.ByText(filterby)).Click();
                    browser.TextField(Find.ById(new Regex("ctl00_MainContent_rpIntegrationSystemErrors_gvIntegrationSystemErrors_DXFREditorcol5_I"))).TypeText(searchstring);
                    break;

                case "AddUser":

                    filters[5].Click();
                    browser.Element(Find.ByText(filterby)).Click();
                    browser.TextField(Find.ById(new Regex("ctl00_MainContent_rpIntegrationSystemErrors_gvIntegrationSystemErrors_DXFREditorcol6_I"))).TypeText(searchstring);
                    break;

                case "ModDt":

                    filters[6].Click();
                    browser.Element(Find.ByText(filterby)).Click();
                    browser.TextField(Find.ById(new Regex("ctl00_MainContent_rpIntegrationSystemErrors_gvIntegrationSystemErrors_DXFREditorcol7_I"))).TypeText(searchstring);
                    break;

                case "ModUser":

                    filters[7].Click();
                    browser.Element(Find.ByText(filterby)).Click();
                    browser.TextField(Find.ById(new Regex("ctl00_MainContent_rpIntegrationSystemErrors_gvIntegrationSystemErrors_DXFREditorcol8_I"))).TypeText(searchstring);
                    break;
            }
        }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:70,代码来源:AdminCommon.cs

示例2: SelectNewWSShop

        /// <summary>
        /// Method selects the Shop on the Admin Work Specification -> Search Work Specification, New Work Specification screen
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="shop">Shop Value</param>
        public void SelectNewWSShop(Browser browser, string shop)
        {
            string shopvalue = browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel1_SpecsGridView_DXEditor3_I"))).Value;

            if(shopvalue.Equals(shop))
            {

                 SendKeys.SendWait("{TAB}");
            }
            else
            {
                    browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel1_SpecsGridView_DXEditor3_I"))).SetAttributeValue("value", "");
                    browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel1_SpecsGridView_DXEditor3_I"))).AppendText(shop.Substring(0, 4));

                    Element sl = browser.Element(Find.ByText(shop));
                    IEElement slele = (IEElement)sl.NativeElement;
                    System.Drawing.Point slclickPoint = gc.GetScreenPoint(slele);
                    gc.Move(slclickPoint);
                    gc.LeftClick(slclickPoint);

                    SendKeys.SendWait("{TAB}");
            }
        }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:28,代码来源:AdminCommon.cs

示例3: SelectWSShop

        /// <summary>
        /// Method selects the Shop on the Admin Work Specification -> Search Work Specification screen
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="shop">Shop Value</param>
        public void SelectWSShop(Browser browser, string shop)
        {
            Element edit = browser.Element(Find.ById(new Regex("ctl00_MainContent_SearchPanel_ShopComboBox_I")));
            IEElement editele = (IEElement)edit.NativeElement;
            System.Drawing.Point editclickPoint = gc.GetScreenPoint(editele);
            gc.Move(editclickPoint);
            gc.LeftClick(editclickPoint);

            browser.TextField(Find.ById(new Regex("ctl00_MainContent_SearchPanel_ShopComboBox_I"))).AppendText(shop.Substring(0, 4));

            TableRowCollection rows = browser.Table(Find.ById(new Regex("ctl00_MainContent_SearchPanel_ShopComboBox_DDD_L_LBT"))).TableRows;

            foreach (TableRow x in rows)
            {

                TableCellCollection test = x.TableCells;

                foreach (TableCell y in test)
                {

                    if (y.Text.Equals(shop))
                    {

                        IEElement innerele = (IEElement)y.NativeElement;
                        System.Drawing.Point innerclickPoint = gc.GetScreenPoint(innerele);
                        gc.Move(innerclickPoint);
                        gc.LeftClick(innerclickPoint);
                        y.Click();
                        return;
                    }
                }

            }
        }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:39,代码来源:AdminCommon.cs

示例4: SelectListItem

        /// <summary>
        ///  Selects an Element from a displayed list on a Field
        ///  Requires focus be set on the Parent field. 
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="listvalue">List Item Value</param>
        public void SelectListItem(Browser browser, string listvalue)
        {
            // Find Element By Text

            Element value = browser.Element(Find.ByText(listvalue));
            IEElement valueele = (IEElement)value.NativeElement;
            System.Drawing.Point vclickpoint = gc.GetScreenPoint(valueele);
            gc.Move(vclickpoint);
            gc.LeftClick(vclickpoint);
        }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:16,代码来源:AdminCommon.cs

示例5: SelectNewWSCompany

        /// <summary>
        /// Method selects the Company on the Admin Work Specification -> Search Work Specification, New Work Specification screen
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="company">Company Value</param>
        public void SelectNewWSCompany(Browser browser, string company)
        {
            Element edit = browser.Element(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel1_SpecsGridView_DXEditor4_I")));
            IEElement editele = (IEElement)edit.NativeElement;
            System.Drawing.Point editclickPoint = gc.GetScreenPoint(editele);
            gc.Move(editclickPoint);
            gc.LeftClick(editclickPoint);

            browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel1_SpecsGridView_DXEditor4_I"))).AppendText(company.Substring(0, 4));

            TableRowCollection rows = browser.Table(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel1_SpecsGridView_DXEditor4_DDD_L_LBT"))).TableRows;

            Console.Write(rows.Count);
            foreach (TableRow x in rows)
            {

                TableCellCollection test = x.TableCells;

                foreach (TableCell y in test)
                {

                    if(y.Text.Equals(company))
                    {

                        IEElement innerele = (IEElement)y.NativeElement;
                        System.Drawing.Point innerclickPoint = gc.GetScreenPoint(innerele);
                        gc.Move(innerclickPoint);
                        gc.LeftClick(innerclickPoint);
                        y.Click();
                        return;
                    }
                }

            }
        }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:40,代码来源:AdminCommon.cs

示例6: SelectFieldType

        /// <summary>
        /// Method selects the Admin -> Edits -> Add Vertical Edits -> BaseMatch -> FieldType
        /// Requires Focus be set on the target element. 
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="fieldtype">Field type to select</param>
        public void SelectFieldType(Browser browser, string fieldtype)
        {
            browser.TextField(Find.ById(new Regex("ctl00_MainContent_EditConditionControl_rpEditCondition_tBoxECType"))).Focus();

            // Find Element By Text
            Element value = browser.Element(Find.ByText(fieldtype));
            IEElement valueele = (IEElement)value.NativeElement;
            System.Drawing.Point vclickpoint = gc.GetScreenPoint(valueele);
            gc.Move(vclickpoint);
            gc.LeftClick(vclickpoint);
        }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:17,代码来源:AdminCommon.cs

示例7: SelectLanguage

        /// <summary>
        /// Method selects the Language on the Admin User -> New User screen
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="language">Language Value</param>
        public void SelectLanguage(Browser browser, string language)
        {
            Element me = browser.Element(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_ASPxRoundPanel1_LanguageDropDown_B-1Img")));
            IEElement newele = (IEElement)me.NativeElement;
            System.Drawing.Point clickPoint = gc.GetScreenPoint(newele);
            gc.Move(clickPoint);
            gc.LeftClick(clickPoint);

            Element sl = browser.Element(Find.ByText(language));
            IEElement slele = (IEElement)sl.NativeElement;
            System.Drawing.Point slclickPoint = gc.GetScreenPoint(slele);
            gc.Move(slclickPoint);
            gc.LeftClick(slclickPoint);
        }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:19,代码来源:AdminCommon.cs

示例8: SelectCompany

        /// <summary>
        /// Method selects the Company on the Admin Labor Standard -> New Labor Standard screent
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="company">Company Value</param>
        public void SelectCompany(Browser browser, string company)
        {
            TextField me = browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel1_BizUnitControl_CompanyDropDownTextBox")));
            IEElement newele = (IEElement)me.NativeElement;
            System.Drawing.Point clickPoint = gc.GetScreenPoint(newele);
            gc.Move(clickPoint);
            gc.LeftClick(clickPoint);

            string companyvalue = company.Substring(0, 4);

            me.AppendText(companyvalue);

            Element sl = browser.Element(Find.ByText(company));
            IEElement slele = (IEElement)sl.NativeElement;
            System.Drawing.Point slclickPoint = gc.GetScreenPoint(slele);
            gc.Move(slclickPoint);
            gc.LeftClick(slclickPoint);
        }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:23,代码来源:AdminCommon.cs

示例9: SelectERType

        /// <summary>
        /// Method selects the Type on the Admin Exception Reasons -> New Exception Reason screen
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="type">Type Value</param>
        public void SelectERType(Browser browser, string type)
        {
            Element edit = browser.Element(Find.ById(new Regex("ctl00_MainContent_ResultsRoundPanel_ExceptionReasonsGridView_DXEditor6_I")));
            IEElement editele = (IEElement)edit.NativeElement;
            System.Drawing.Point editclickPoint = gc.GetScreenPoint(editele);
            gc.Move(editclickPoint);
            gc.LeftClick(editclickPoint);

            TableRowCollection rows = browser.Table(Find.ById(new Regex("ctl00_MainContent_ResultsRoundPanel_ExceptionReasonsGridView_DXEditor6_DDD_L_LBT"))).TableRows;

            foreach (TableRow x in rows)
            {

                TableCellCollection test = x.TableCells;

                foreach (TableCell y in test)
                {

                    if (y.Text.Equals(type))
                    {

                        IEElement innerele = (IEElement)y.NativeElement;
                        System.Drawing.Point innerclickPoint = gc.GetScreenPoint(innerele);
                        gc.Move(innerclickPoint);
                        gc.LeftClick(innerclickPoint);
                        y.Click();
                        return;
                    }
                }

            }
        }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:37,代码来源:AdminCommon.cs

示例10: PopulateTestPage

        private string PopulateTestPage(ObituaryAdd oa, Browser browser)
        {
            var firstName = string.Format("DecFirst{0:MMddyyyy_hhmmss}", DateTime.Now);
            var lastName = string.Format("DecLast{0:MMddyyyy_hhmmss}", DateTime.Now);

            oa.txtDecFirstName = firstName;
            oa.txtDecLastName = lastName;

            oa.cmdDayDeath.Options[3].Select();
            oa.cmdMonthDeath.Options[3].Select();
            oa.drpMemorialDeathYear.Options[3].Select();

            oa.txtContactFirstName = "ConFirst";
            oa.txtContactLastName = "ConLast";

            oa.txtContactPhone = "9205551212";

            oa.txtObituary = "[center]Centered[/center]";
            browser.Eval("window.eaaRichEdit.update()");
            var previewDiv = (ElementContainer<Element>)browser.Element(Find.ById("main_0_eaamain_0_eaacontent_0_acmain_1_view_text"));
            Assert.AreEqual(previewDiv.InnerHtml, "<center>Centered</center>");

            return firstName;
        }
开发者ID:tzerb,项目名称:VisualStudioTools,代码行数:24,代码来源:ObituaryAddTests.cs

示例11: GetActualSubMenus

        /// <summary>
        /// Method to retrieve all submenus from a visible menu
        /// </summary>
        /// <param name="browser"></param>
        /// <param name="menu"></param>
        /// <returns></returns>
        public List<String> GetActualSubMenus(Browser browser, string menu)
        {
            List<String> results = new List<String>();
            try
            {
                string menuid = browser.Element(Find.ByText(menu)).Id;
                int start = menuid.Length - 2;
                string searchid = menuid.Remove(start, 2);

                ElementCollection submenus = browser.Elements.Filter(Find.ById(new Regex(searchid))).Filter(Find.ByClass("dxmSubMenuItem"));

                foreach (Element x in submenus)
                {
                    // Console.Write(x.Text + Environment.NewLine);
                    results.Add(x.Text);

                }

                return results;
            }
            catch(Exception ex)
            {
                Console.Write("Get Actual Sub Menus Failed with Exception: " + ex.Message);
                return results;


            }
        }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:34,代码来源:GlobalCommonActions.cs

示例12: HomeSelect

 /// <summary>
 /// Method to Select the Home Menu Item
 /// </summary>
 /// <param name="browser">WatiN Browser Object</param>
 /// <param name="selection"></param>
 public void HomeSelect(Browser browser, string selection)
 {
     // Click Home menu item
     browser.Element(Find.ByText(new Regex("Home"))).Click();            
 }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:10,代码来源:GlobalCommonActions.cs

示例13: MenuSelect

        /// <summary>
        /// Method to Select a Menu and Submenu by Text.
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="menu"></param>
        /// <param name="selection"></param>
        public void MenuSelect(Browser browser, string menu, string selection)
        {

            Element loading = browser.Element(Find.ByText(new Regex(menu)));
            System.Drawing.Point clickPoint = GetScreenPoint((IEElement)loading.NativeElement);
            Move(clickPoint);
            try
            {
                browser.WaitUntilContainsText(selection, 5);
            }
            catch
            {
                return;
            }
            // Get Parent of Selection
            Element test = browser.Link(Find.ByText(selection)).Parent;
            test.Click();

        }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:25,代码来源:GlobalCommonActions.cs

示例14: Login

        /// <summary>
        /// Method to Login to the Entrust Application
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        public void Login(Browser browser, string username, string password)
        {

            Element usernamefield = browser.Element(Find.ById(new Regex("username")));
            System.Drawing.Point clickPoint = GetScreenPoint((IEElement)usernamefield.NativeElement);
            Move(clickPoint);

           browser.TextField(Find.ById(new Regex("username"))).SetAttributeValue("value", username);
           browser.TextField(Find.ById(new Regex("password"))).SetAttributeValue("value", password);
           browser.Button(Find.ByValue(new Regex("Log In"))).ClickNoWait();
           browser.WaitForComplete();           
                
        }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:19,代码来源:GlobalCommonActions.cs


注:本文中的Browser.Element方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。