當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。