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


C# Browser类代码示例

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


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

示例1: TestUserverifylad

        public void TestUserverifylad(Browser browser)
        {
            browser.Link(Find.ById("ctl00_linkTrade")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南"));

            browser.Link(Find.ByText("我要销售")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作"));

            browser.Link(Find.ByText("我的议价信息")).Click();
            browser.WaitUntilContainsText("合同号");
            Assert.IsTrue(browser.ContainsText("合同号"));

            browser.Link(Find.ByText("议价")).Click();

            //WatiN.Core.DialogHandlers.ConfirmDialogHandler dh3 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            //browser.AddDialogHandler(dh3);

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnAccept")).ClickNoWait();
            //dh3.WaitUntilExists(15);//
            //dh3.OKButton.Click();//
            //browser.RemoveDialogHandler(dh3);

            //Thread.Sleep(2000);
        }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:27,代码来源:verifybargain.cs

示例2: AddBadActor

        /// <summary>
        /// Method to Add a Bad Actor
        /// See AddVerticalEdit for param description
        /// </summary>
        /// <param name="browser">WatiN Browser Object</param>
        /// <param name="name"></param>
        /// <param name="level"></param>
        /// <param name="efrom"></param>
        /// <param name="eto"></param>
        /// <param name="exception"></param>
        /// <param name="errortype"></param>
        /// <param name="days"></param>
        /// <param name="errcount"></param>
        /// <param name="countat"></param>
        /// <param name="recprob"></param>
        /// <param name="source"></param>
        /// <param name="errorlevel"></param>
        /// <param name="reqcon"></param>
        /// <param name="configpath"></param>
        /// <param name="basematches"></param>
        /// <param name="associatedmatches"></param>
        /// <param name="commit"></param>
        /// <param name="save"></param>
        /// 
        public void AddBadActor(Browser browser, string name, string level, string efrom, string eto, string exception, string errortype, string days, string errcount, 
          string countat,  string recprob, string source, string errorlevel, string reqcon, string configpath, bool basematches, bool associatedmatches, bool commit, bool save)
        {
            XmlDocument xmldoc = new XmlDocument();
            xmldoc.Load(configpath);

            XmlNode xn = xmldoc.SelectSingleNode("//config/admin/matchpath");
            string basepath = xn.InnerText;

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

            browser.WaitUntilContainsText("Effective From");

            EditDetails(browser, name, level, efrom, eto, exception, errortype, recprob, source, errorlevel);

            browser.TextField(Find.ById(new Regex("ctl00_MainContent_rpEditDetails_tBoxTSID"))).SetAttributeValue("value", days);
            browser.TextField(Find.ById(new Regex("ctl00_MainContent_rpEditDetails_tBoxNoOfTimes"))).SetAttributeValue("value", errcount);
            browser.RadioButton(Find.ByLabelText(countat)).Checked = true;

            if (basematches == true)
            {
                EditBaseMatches(browser, basepath, commit);
            }

            SaveDetails(browser, save);
        }
开发者ID:johnbcook,项目名称:automation-samples,代码行数:50,代码来源:AdminCommon.cs

示例3: SearchingAnInputElementBySeveralSelectingMethods

        public void SearchingAnInputElementBySeveralSelectingMethods()
        {
            Browser b = new Browser();
            b.SetContent(Helper.GetFromResources("SimpleBrowser.UnitTests.SampleDocs.SimpleForm.htm"));

            var colorBox = b.Find("colorBox"); // find by id
            Assert.That(colorBox.Count() == 1, "There should be exactly 1 element with ID colorBox");

            colorBox = b.Find("input", new {name="colorBox", type="color"}); // find by attributes
            Assert.That(colorBox.Count() == 1, "There should be exactly 1 element with name colorBox and type color");

            colorBox = b.Find("input", new { name = "colorBox", type = "Color" }); // find by attributes
            Assert.That(colorBox.Count() == 1, "There should be exactly 1 element with name colorBox and type color");

            colorBox = b.Find("input", new { name = "colorBox", type = "Colors" }); // find by attributes
            Assert.That(colorBox.Exists == false, "There should be no element with name colorBox and type Colors");

            colorBox = b.Find(ElementType.TextField, new { name = "colorBox", type = "Color" }); // find by attributes
            Assert.That(colorBox.Count() == 0, "Input elements with types other than text, password and hidden should not be found");

            colorBox = b.Find("input", FindBy.Name, "colorBox"); // find by FindBy
            Assert.That(colorBox.Count() == 1, "There should be exactly 1 element with name colorBox");

            colorBox = b.Select("input[name=colorBox]"); // find by Css selector
            Assert.That(colorBox.Count() == 1, "There should be exactly 1 element with name colorBox");

            colorBox = b.Select("input[type=color]"); // find by Css selector
            Assert.That(colorBox.Count() == 1, "There should be exactly 1 element with type color");

            colorBox = b.Select("input[type=Color]"); // find by Css selector
            Assert.That(colorBox.Count() == 0, "There should be no element for the expression input[type=Color] (CSS is case sensitive)");

            var clickLink = b.Select(".clickLink"); // find by Css selector
            Assert.That(clickLink.Count() == 1, "There should be one element for the expression .clickLink");
        }
开发者ID:bubish,项目名称:SimpleBrowser,代码行数:35,代码来源:Selectors.cs

示例4: Should_fail_to_resolve_route_because_it_does_have_an_invalid_condition

        public void Should_fail_to_resolve_route_because_it_does_have_an_invalid_condition()
        {
            // Given
            var cache = new FakeRouteCache(with => {
                with.AddGetRoute("/invalidcondition", "modulekey", ctx => false);
            });

            var bootstrapper = new ConfigurableBootstrapper(with =>{
                with.RouteCache(cache);
            });

            var browser = new Browser(bootstrapper);

            // When
            var timer = new Stopwatch();
            timer.Start();

            for (var i = 0; i < numberOfTimesToResolveRoute; i++)
            {
                var result = browser.Get("/invalidcondition");
                result.StatusCode.ShouldEqual(HttpStatusCode.NotFound);
            }

            timer.Stop();

            // Then
            Debug.WriteLine(" took {0} to execute {1} times", timer.Elapsed, numberOfTimesToResolveRoute);
        }
开发者ID:felbus,项目名称:Nancy,代码行数:28,代码来源:DefaultRouteResolverPerformanceFixture.cs

示例5: BrowserFixture

        public BrowserFixture()
        {
            var bootstrapper =
                new FakeNancyBootstrapper();

            this.browser = new Browser(bootstrapper);
        }
开发者ID:nuxleus,项目名称:Nancy,代码行数:7,代码来源:BrowserFixture.cs

示例6: TestUserOrderPaymentInfo

        public void TestUserOrderPaymentInfo(Browser browser)
        {
            browser.WaitUntilContainsText("Step 4: Enter Payment Information");
            Assert.IsTrue(browser.ContainsText("Step 4: Enter Payment Information"));

            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_txt_user_firstname")).TypeText("christie");

            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_txt_user_lastname")).TypeText("Test");

            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_txt_user_addr")).TypeText("zhongshanbeiroad");

            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_txt_user_city")).TypeText("shanghai");

            browser.SelectList(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_dl_user_state")).Option(Find.ByValue("AL")).Select();
            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_txt_user_zip")).TypeText("11111");

            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_ux_phone")).Value="1111111111";
            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_ux_phone")).Focus();
            //browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_ux_phone")).DoubleClick();

            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_txt_user_email")).TypeText("[email protected]");

            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_txt_order_description")).TypeText("ordertest");
            browser.CheckBox(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_chbAgreement")).Checked = true;
            browser.CheckBox(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_chb_contactinfo")).Checked = true;
            browser.SelectList(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_dl_pay_year")).Option("2011").Select();

            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_txt_pay_account")).TypeText("4111111111111111");

            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_txt_pay_cid")).TypeText("111");
            browser.Link(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_BottomBtNext")).Click();

            browser.WaitUntilContainsText("Your Order Is Complete");
            Assert.IsTrue(browser.ContainsText("Your Order Is Complete"));
        }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:35,代码来源:OrderPaymentInfo.cs

示例7: HandleRequestLogged

		private void HandleRequestLogged(Browser b, HttpRequestLog req)
		{
			if (this.RequestLogged != null)
			{
				this.RequestLogged(b, req);
			}
		}
开发者ID:aqueduct,项目名称:SimpleBrowser.WebDriver,代码行数:7,代码来源:BrowserWrapper.cs

示例8: AddFriend

        public static void AddFriend(Browser browser)
        {
            loginPage = new LoginPage(browser);
            loginPage.LoginUser(TelerikUser.Related1);

            mainPage = new MainPage(browser);
            mainPage.NavigateTo(TelerikUser.Related2.Url);

            userPage = new UserProfilePage(browser);
            if (userPage.AddFriendButton != null && userPage.AddFriendButton.IsVisible())
            {
                userPage.ClickAddFriendButton();
                mainPage.ClickLogout();

                mainPage.NavigateTo(loginPage.Url);
                loginPage.LoginUser(TelerikUser.Related2);

                friendsPage = new FriendsPage(browser);
                mainPage.NavigateTo(friendsPage.Url);
                friendsPage.ClickApproveFriendshipIcon();
            }

            mainPage.ClickLogout();
            mainPage.NavigateTo(loginPage.Url);
            loginPage.LoginUser(TelerikUser.Related1);
        }
开发者ID:Team-Lich,项目名称:TestsAndPlans,代码行数:26,代码来源:RelatedUsersUtilities.cs

示例9: Main

        static void Main(string[] args)
        {
            ExamplePresenter.Init();

            Browser browser = new Browser();
            Application.Run(browser);
        }
开发者ID:andrewrawding,项目名称:CefSharp,代码行数:7,代码来源:Program.cs

示例10: TestUserspecialtylists

        public void TestUserspecialtylists(Browser browser)
        {
            browser.WaitUntilContainsText("Please complete the short form below and a Data Specialist will follow up with you");
            Assert.IsTrue(browser.ContainsText("Please complete the short form below and a Data Specialist will follow up with you"));

            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_ux_fir_name")).TypeText("bobby");

            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_ux_last_name")).TypeText("wang");

            //browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_txt_user_addr")).TypeText("zhongshanbeiroad");

            //browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_txt_user_city")).TypeText("shanghai");

            //browser.SelectList(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_dl_user_state")).Option(Find.ByValue("AL")).Select();
            //browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_txt_user_zip")).TypeText("11111");

            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_ux_phone")).TypeText("1111111111");
            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_ux_phone")).Focus();

            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_ux_email")).TypeText("[email protected]");
            browser.SelectList(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_uxHowMany")).Option(Find.ByValue("1,001 - 5,000")).Select();
            browser.SelectList(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_uxHowSoon")).Option(Find.ByValue("Immediately")).Select();
            browser.SelectList(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_uxInterest")).Option(Find.ByValue("Ailments")).Select();
            browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_uxTarget")).TypeText("test");
            browser.Image(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_ImageButton1")).Click();

            browser.WaitUntilContainsText("Thank you! We have received your request and we will follow up with you within the next business day");
            Assert.IsTrue(browser.ContainsText("Thank you! We have received your request and we will follow up with you within the next business day"));
        }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:29,代码来源:specialtylists.cs

示例11: WebPage

 public WebPage()
 {
     this.browser = new Browser();
     this.browser.Size = new Size(1024, 800);
     this.browser.ScrollBarsEnabled = false;
     this.browser.ObjectForScripting = new Callback.External();
 }
开发者ID:nivertech,项目名称:trifleJS,代码行数:7,代码来源:WebPage.cs

示例12: GetBrowserExePath

        /// <summary>
        /// Resolving a browser exe path based on the Setting.
        /// </summary>
        /// <param name="browser"><see cref="Broser"/> type.</param>
        /// <returns>Path to the exe for specific browser.</returns>
        public static string GetBrowserExePath(Browser browser)
        {
            var path = string.Empty;
            var settings = Properties.Settings.Default;

            switch (browser)
            {
                case Browser.IE:
                    path = settings.IeExePath;
                    break;
                case Browser.Chrome:
                    path = settings.ChromeExePath;
                    break;
                case Browser.Firefox:
                    path = settings.FirefoxExePath;
                    break;
                case Browser.Opera:
                    path = settings.OperaExePath;
                    break;
                default:
                    path = settings.IeExePath;
                    break;
            }

            if (string.IsNullOrWhiteSpace(path))
            {
                throw new InvalidOperationException(string.Format("Path to the browser exe for {0} can not be empty.", browser.ToString()));
            }

            return path;
        }
开发者ID:megadotnet,项目名称:ironframework,代码行数:36,代码来源:BrowserFactory.cs

示例13: TestUsercanceldiscont

        public void TestUsercanceldiscont(Browser browser,string raid,string raname)
        {
            browser.Link(Find.ByText("平台管理")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南"));

            browser.Link(Find.ByText("销售折扣管理")).Click();
            browser.WaitUntilContainsText("折扣设置");
            Assert.IsTrue(browser.ContainsText("折扣设置"));

            //状态生效

            browser.RadioButton(Find.ById(raid)).Checked = true;

            WatiN.Core.DialogHandlers.ConfirmDialogHandler dh4 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            browser.AddDialogHandler(dh4);

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnDelete")).ClickNoWait();
            dh4.WaitUntilExists(15);//
            dh4.OKButton.Click();//

            browser.RemoveDialogHandler(dh4);
            Thread.Sleep(1000);
            Assert.IsFalse(browser.ContainsText(raname));
        }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:26,代码来源:canceldiscont.cs

示例14: MethodRewriteFixture

 public MethodRewriteFixture()
 {
     this.browser = new Browser(with =>
     {
         with.Module<MethodRewriteModule>();
     });
 }
开发者ID:kenWeeMuu,项目名称:Nancy,代码行数:7,代码来源:MethodRewriteFixture.cs

示例15: SetMapDesiredCount

        public void SetMapDesiredCount(int CountNumber, Browser browser)
        {
            browser.TextField("ctl00_ctl00_uxContent_ContentPlaceHolder1_gvOrderResults_ctl02_tbDesQty").WaitUntilExists(20);
            browser.TextField("ctl00_ctl00_uxContent_ContentPlaceHolder1_gvOrderResults_ctl02_tbDesQty").TypeText(CountNumber.ToString());

            browser.Span((Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_tbTolDesQty")) && (Find.ByText(CountNumber.ToString()))).WaitUntilExists(30);
        }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:7,代码来源:SaveCount.cs


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