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


C# Browser.Close方法代码示例

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


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

示例1: ClosingBrowsers

 public void ClosingBrowsers()
 {
     Browser b = new Browser(Helper.GetMoviesRequestMocker());
     HttpRequestLog lastRequest = null;
     b.RequestLogged += (br, l) =>
     {
         lastRequest = l;
     };
     b.Navigate("http://localhost/movies/");
     Assert.That(b.Url == new Uri("http://localhost/movies/"));
     var link = b.Find(ElementType.Anchor, FindBy.Text, "About us");
     link.Click();
     Assert.That(b.Url == new Uri("http://localhost/movies/"));
     Assert.That(Browser.Windows.Count() == 2);
     b.Close();
     Assert.That(Browser.Windows.Count() == 1);
     Browser.Windows.First().Close();
     Assert.That(Browser.Windows.Count() == 0);
     Assert.Throws(typeof(ObjectDisposedException), () => { Uri s = b.Url; });
 }
开发者ID:Buildstarted,项目名称:SimpleBrowser,代码行数:20,代码来源:WindowsAndFrames.cs

示例2: SearchWorkSpec

        /// <summary>
        /// Method to Search for a Work Specification
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="code">Code Value</param>
        /// <param name="description">Description Value</param>
        /// <param name="shop">Shop Value</param>
        /// <param name="company">Company Value</param>
        /// <param name="includeinactive">Include Inactive Value</param>
        public void SearchWorkSpec(Browser browser, string code, string description, string shop, string company,  bool includeinactive)
        {
            try
            {
                browser.TextField(Find.ById(new Regex("ctl00_MainContent_SearchPanel_SpecCodeTextBox"))).SetAttributeValue("value", code);
                browser.TextField(Find.ById(new Regex("ctl00_MainContent_SearchPanel_SpecNameTextBox"))).SetAttributeValue("value", description);

                if (!shop.Equals(""))
                {
                    SelectWSShop(browser, shop);

                }

                if (!company.Equals(""))
                {
                    SelectWSCompany(browser, company);
                }

                browser.CheckBox(Find.ById(new Regex("ctl00_MainContent_SearchPanel_InactiveCheckBox"))).Checked = includeinactive;
                browser.Button(Find.ById(new Regex("ctl00_MainContent_SearchPanel_SearchButton"))).Click();

            }
            catch
            {

                browser.Close();

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

示例3: SearchWarrantyVendors

        /// <summary>
        /// Performs a Search for Admin Warranty Vendors
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="code"></param>
        /// <param name="name"></param>
        /// <param name="includeinactive"></param>
        public void SearchWarrantyVendors(Browser browser, string code, string name, bool includeinactive)
        {
            try
            {
                browser.TextField(Find.ById(new Regex("ctl00_MainContent_SearchRoundPanel_CompanyCodeTextBox"))).SetAttributeValue("value", code);
                browser.TextField(Find.ById(new Regex("ctl00_MainContent_SearchRoundPanel_CompanyNameTextBox"))).SetAttributeValue("value", name);
                browser.CheckBox(Find.ByLabelText("Include Inactive")).Checked = includeinactive;

                browser.Button(Find.ById(new Regex("ctl00_MainContent_SearchRoundPanel_SearchButton"))).Click();

            }
            catch
            {

                browser.Close();

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

示例4: SearchUser

        /// <summary>
        /// Method performs a Search for a User on the Admin -> Search User page. 
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="firstname">First Name Value</param>
        /// <param name="lastname">Last Name Value</param>
        /// <param name="username">User Name Value</param>
        /// <param name="includeinactive">Will set Include Inactive Checked value</param>
        public void SearchUser(Browser browser, string firstname, string lastname, string username, bool includeinactive)
        {
            try
            {
                browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_FirstNameTextBox"))).SetAttributeValue("value", firstname);
                browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_LastNameTextBox"))).SetAttributeValue("value", lastname);
                browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_UserCodeTextBox"))).TypeText(username);
                browser.CheckBox(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_IncludeInactiveCheckBox"))).Checked = includeinactive;
                browser.Button(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_Button1"))).Click();

                browser.Refresh();
            }
            catch
            {

                browser.Close();

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

示例5: SearchJobCode

        /// <summary>
        /// Method to search Admin Labor Standards by a specific job code
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="code">Code Value</param>
        /// <param name="includeinactive">Include Inactive Value</param>
        /// 
        public void SearchJobCode(Browser browser, string code, bool includeinactive)
        {
            try
            {
                browser.TextField(Find.ById(new Regex("ctl00_MainContent_RoundSearchPanel_JCEdit"))).SetAttributeValue("value", code);
                browser.CheckBox(Find.ById(new Regex("ctl00_MainContent_RoundSearchPanel_IncludeExpired"))).Checked = includeinactive;

                browser.Button(Find.ById(new Regex("ctl00_MainContent_RoundSearchPanel_SubmitSearch"))).Click();

            }
            catch
            {

                browser.Close();

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


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