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


C# FirefoxDriver.Close方法代码示例

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


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

示例1: Parse

        public List<FootballItem> Parse() {
            List<FootballItem> res = new List<FootballItem>();

            IWebDriver driver = new FirefoxDriver();

            driver.Navigate().GoToUrl("https://www.marathonbet.com/su/popular/Football/?menu=true#");
            ReadOnlyCollection<IWebElement> main = driver.FindElements(By.ClassName("sport-category-container"));
            Debug.Assert(main.Count==1);
            ReadOnlyCollection<IWebElement> containers = main[0].FindElements(By.ClassName("category-container"));
            foreach (IWebElement container in containers) {
                ReadOnlyCollection<IWebElement> tables = container.FindElements(By.ClassName("foot-market"));
                Debug.Assert(tables.Count==1);
                ReadOnlyCollection<IWebElement> tbodys = tables[0].FindElements(By.XPath(".//tbody[@data-event-name]"));
                ParseTBody(tbodys, res);
            }

            /*
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
            wait.Until((d) => { return d.Title.ToLower().StartsWith("cheese"); });
            */
            driver.Close();
            driver.Quit();

            return res;
        }
开发者ID:mgerasika,项目名称:football-site-parser,代码行数:25,代码来源:FootballSiteParser.cs

示例2: PostToBlog

 public void PostToBlog()
 {
     IWebDriver browser = new FirefoxDriver();
     browser.Navigate().GoToUrl("http://tumblr.com/login");
     IWebElement email = browser.FindElement(By.Id("signup_determine_email"));
     email.SendKeys("[email protected]");
     IWebElement verifyButton = browser.FindElement(By.Id("signup_forms_submit"));
     verifyButton.Click();
     browser.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
     IWebElement password = browser.FindElement(By.Id("signup_password"));
     password.SendKeys("******");
     IWebElement loginButton = browser.FindElement(By.Id("signup_forms_submit"));
     loginButton.Click();
     IWebElement textIcon = browser.FindElement(By.ClassName("icon_post_text"));
     textIcon.Click();
     IWebElement postTitle = browser.FindElement(By.ClassName("editor-plaintext"));
     postTitle.SendKeys("c# selenium");
     IWebElement postBody = browser.FindElement(By.ClassName("editor-richtext"));
     postBody.SendKeys("this is a c# with selenium test");
     IWebElement createPost = browser.FindElement(By.ClassName("create_post_button"));
     createPost.Click();
     //TearDown
     IWebElement postSettings = browser.FindElement(By.ClassName("post_control_menu"));
     postSettings.Click();
     IWebElement postDelete = browser.FindElement(By.ClassName("delete"));
     postDelete.Click();
     IWebElement okButton = browser.FindElement(By.ClassName("btn_1"));
     okButton.Click();
     IWebElement accountButton = browser.FindElement(By.ClassName("icon_user_settings"));
     browser.Close();
 }
开发者ID:tking16,项目名称:Selenium,代码行数:31,代码来源:UnitTest1.cs

示例3: CloseSafely

 private void CloseSafely(FirefoxDriver browser)
 {
     try
     {
         browser.Close();
     }
     catch (Exception)
     {
     }
 }
开发者ID:wheeliemow,项目名称:SeleniumWithXunit,代码行数:10,代码来源:BrowserPool.cs

示例4: TestFlowControl_Demo1

        public void TestFlowControl_Demo1()
        {
            IWebDriver driver = new FirefoxDriver();   
            // 1. 隐式的等待 同步测试
            driver.Manage().Timeouts()
                .ImplicitlyWait(TimeSpan.FromSeconds(10))
                .SetPageLoadTimeout(TimeSpan.FromSeconds(10))
                .SetScriptTimeout(TimeSpan.FromSeconds(10));

            driver.Close();
        }
开发者ID:DemoCnblogs,项目名称:Selenium,代码行数:11,代码来源:Lesson06_TestFlowControl.cs

示例5: SearchForCuteSealsGoogle

        public void SearchForCuteSealsGoogle()
        {
            IWebDriver driver = new FirefoxDriver();

            driver.Navigate().GoToUrl("http://www.google.com");
            driver.Manage().Window.Maximize();

            IWebElement searchInput = driver.FindElement(By.Id("gbqfq"));
            searchInput.SendKeys("cute seals");
            searchInput.SendKeys(OpenQA.Selenium.Keys.Enter);
            driver.Close();
        }
开发者ID:juni-j,项目名称:arf,代码行数:12,代码来源:CodedUITest1.cs

示例6: Main

        static void Main(string[] args)
        {
            IWebDriver driver = new FirefoxDriver();

            driver.Navigate().GoToUrl("http://www.bing.com");
            driver.Manage().Window.Maximize();

            IWebElement searchInput = driver.FindElement(By.Id("sb_form_q"));
            searchInput.SendKeys("cute seals");
            searchInput.SendKeys(Keys.Enter);
            driver.Close();
        }
开发者ID:juni-j,项目名称:arf,代码行数:12,代码来源:Program.cs

示例7: XpathTest

        public void XpathTest()
        {
            IWebDriver driver = new FirefoxDriver();
            driver.Navigate().GoToUrl("http://www.thetestroom.com/webapp");

            // locate the contact link using xpath and click on it
            driver.FindElement(By.XPath("//a[contains(@id, 'contact_link')]")).Click();

            // Now we are on the "Contact" page
            // locate the name input on "Contact" page using xpath and enter text into it
            driver.FindElement(By.XPath("//input[contains(@name, 'name_field')]")).SendKeys("test name");

            driver.Close();
        }
开发者ID:fergonus,项目名称:java-unit-csharp,代码行数:14,代码来源:BasicXpathTest.cs

示例8: Main

        static void Main(string[] args)
        {
            IWebDriver driver = new FirefoxDriver();

            driver.Navigate().GoToUrl("http://bing.com/");
            driver.Manage().Window.Maximize();

            IWebElement sString = driver.FindElement(By.Id("sb_form_q"));
            sString.SendKeys("Hello world");

            IWebElement sSubmit = driver.FindElement(By.Id("sb_form_go"));
            sSubmit.Click();

            driver.Close();
        }
开发者ID:KolomakinA,项目名称:SeleniumHelloWorld,代码行数:15,代码来源:Program.cs

示例9: SearchGoogle

        public void SearchGoogle()
        {
            IWebDriver Browser = new FirefoxDriver();

            GoogleLanding landing = new GoogleLanding(Browser);
            landing.Navigate("http://www.google.com");
            landing.SendKeys_SearchBar("Sting Ray");
            landing.Click_SearchButton();

            Thread.Sleep(5000);
            landing.Click_Result(2);
            Thread.Sleep(5000);

            Assert.AreEqual(Browser.Url, "http://www.autodesk.com/products/stingray/overview");

            Browser.Close();
        }
开发者ID:SwarmAutomation,项目名称:WebDriverExtendedDotNet,代码行数:17,代码来源:Google.cs

示例10: SeleniumAPI_Demo1

        public void SeleniumAPI_Demo1()
        {
            _output.WriteLine("Step 01 : 启动浏览器并打开博客园首页。");
            IWebDriver driver = new FirefoxDriver();
            driver.Url = "http://www.cnblogs.com";

            _output.WriteLine("Step 02 : 寻找需要检查的页面元素。");
            var lnkHome = driver.FindElement(By.XPath(".//ul[@class='post_nav_block']/li[1]/a"));
            var value = lnkHome.GetAttribute("class");
            lnkHome.GetCssValue("font-family");
            lnkHome.GetCssValue("color");
            
            _output.WriteLine(string.Format("导航内栏内容:{0}", lnkHome.Text));

            _output.WriteLine("Step 04 : 关闭浏览器。");
            driver.Close();
        }
开发者ID:DemoCnblogs,项目名称:Selenium,代码行数:17,代码来源:Lesson04_05_SeleniumAPI.cs

示例11: TestMethod1

 public void TestMethod1()
 {
     var driver = new FirefoxDriver();
     try
     {
         driver.Navigate().GoToUrl("http://docs.seleniumhq.org/oops");
         driver.FindElement(By.Id("q")).Click();
         driver.Keyboard.SendKeys("Hello World!");
         driver.Keyboard.PressKey(Keys.Enter);
     }
     catch (Exception e)
     {
         var ss = driver.GetScreenshot(); 
         ss.SaveAsFile("failed-test-case.png", ImageFormat.Png);
         driver.Close();
         throw;
     }
 }
开发者ID:Jetabroad,项目名称:DotNetUserGroup,代码行数:18,代码来源:UnitTests.cs

示例12: TestDriver

        public static void TestDriver()
        {
            var url = "https://jerdine.smartbizonline.com";

            IWebDriver driver = new FirefoxDriver();

            // Navigate to url
            driver.Navigate().GoToUrl(url);

            // Login
            driver.FindElement(By.Id("txtUserName")).Clear();
            driver.FindElement(By.Id("txtUserName")).SendKeys("[email protected]");
            driver.FindElement(By.Id("Password")).Clear();
            driver.FindElement(By.Id("Password")).SendKeys("1234");
            driver.FindElement(By.XPath("//button[text()='Login']")).Click();

            driver.Close();
        }
开发者ID:jerdinekate,项目名称:AlalaySolution,代码行数:18,代码来源:Test.cs

示例13: CoreObject_Demo1

        public void CoreObject_Demo1()
        {
            _output.WriteLine("Step 01 : 启动浏览器并打开博客园首页。");
            IWebDriver driver = new FirefoxDriver();
            driver.Url = "http://www.cnblogs.com";
            driver.Manage().Window.Maximize();

            _output.WriteLine("Step 02 : 获取并输出部分页面信息。");
            _output.WriteLine(string.Format("Current window handle: {0}", driver.CurrentWindowHandle));
            _output.WriteLine(string.Format("Window handle count: {0}", driver.WindowHandles.Count));
            _output.WriteLine(string.Format("Current window title: {0}", driver.Title));

            _output.WriteLine("Step 03 : 验证博客园站点的 Title 是否正确。");
            Assert.Equal<string>("博客园 - 开发者的网上家园", driver.Title);

            _output.WriteLine("Step 04 : 关闭当前页面。");
            driver.Close();
        }
开发者ID:DemoCnblogs,项目名称:Selenium,代码行数:18,代码来源:Lesson02_CoreObject.cs

示例14: Main

        static void Main(string[] args)
        {
            IWebDriver driver = new FirefoxDriver();
            driver.Navigate().GoToUrl("http://www.rmv.de");
            //driver.Navigate().GoToUrl(baseURL + "/");
            driver.FindElement(By.Id("myname")).Clear();
            driver.FindElement(By.Id("myname")).SendKeys("[email protected]");
            driver.FindElement(By.Id("mypw")).Clear();
            driver.FindElement(By.Id("mypw")).SendKeys("Keith)98");
            //driver.FindElement(By.CssSelector("button.a11y-focus")).Click();
            driver.FindElement(By.XPath("//*[text()=\"Login\"]")).Click();
            driver.FindElement(By.Id("searchbar")).Click();
            driver.FindElement(By.Id("searchbar")).Clear();
            driver.FindElement(By.Id("searchbar")).SendKeys("hamburg");
            driver.FindElement(By.XPath("//*[text()=\"Suchen\"]")).Click();
            driver.FindElement(By.LinkText("Logout")).Click();

            driver.Close();
        }
开发者ID:nagappank,项目名称:NUnitSeleniumRepoTestcaseRMV,代码行数:19,代码来源:Program.cs

示例15: Main

        static void Main(string[] args)
        {
            //Create the reference for our browser
            IWebDriver driver = new FirefoxDriver();

            driver.Navigate().GoToUrl(@"D:\Dropbox\ValtechProjects\WEB\Calculator\index.html");

            //Find the element
            IWebElement btn_0 = driver.FindElement(By.Name("0"));
            IWebElement btn_1 = driver.FindElement(By.Name("1"));
            IWebElement btn_2 = driver.FindElement(By.Name("2"));
            IWebElement btn_3 = driver.FindElement(By.Name("3"));
            IWebElement btn_4 = driver.FindElement(By.Name("4"));
            IWebElement btn_5 = driver.FindElement(By.Name("5"));
            IWebElement btn_6 = driver.FindElement(By.Name("6"));
            IWebElement btn_7 = driver.FindElement(By.Name("7"));
            IWebElement btn_8 = driver.FindElement(By.Name("8"));
            IWebElement btn_9 = driver.FindElement(By.Name("9"));
            IWebElement btn_minus = driver.FindElement(By.Name("-"));
            IWebElement btn_plus = driver.FindElement(By.Name("+"));
            IWebElement btn_divide = driver.FindElement(By.Name("/"));
            IWebElement btn_multi = driver.FindElement(By.Name("*"));
            IWebElement btn_equal = driver.FindElement(By.Name("="));
            IWebElement btn_clear = driver.FindElement(By.Name("c"));
            
            btn_0.Click();
            btn_1.Click();
            btn_2.Click();
            btn_3.Click();
            btn_4.Click();
            btn_5.Click();
            btn_6.Click();
            btn_7.Click();
            btn_8.Click();
            btn_9.Click();
            btn_divide.Click();
            btn_minus.Click();
            btn_multi.Click();
            btn_plus.Click();
            btn_equal.Click();
            btn_clear.Click();
            driver.Close();
        }
开发者ID:kenobit,项目名称:Valtech_tasks,代码行数:43,代码来源:Program.cs


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