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


C# InternetExplorerDriver.FindElements方法代码示例

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


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

示例1: CanGetTweetsOnDefaultPage

        public void CanGetTweetsOnDefaultPage()
        {
            IWebDriver driver = new InternetExplorerDriver();

            driver.Navigate().GoToUrl("http://localhost:51373/");

            IWebElement button = driver.FindElement(By.Id("btn"));
            button.Click();

            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
            wait.Until((d) => { return d.FindElement(By.Id("results")); });

            IList<IWebElement> results = driver.FindElements(By.XPath("//ul[@id='results']/li"));
            IList<IWebElement> accounts = driver.FindElements(By.XPath("//div[@id='summary']//tr"));

            //Assert.AreEqual(1, results.Count);
            Assert.IsTrue(results.Count > 0);
            //Assert.AreEqual(1, accounts.Count);
            Assert.IsTrue(accounts.Count > 1);

            // Close the browser
            //driver.Quit();
        }
开发者ID:mathewvance,项目名称:MathewVanceVerrusTechnicalAssignment,代码行数:23,代码来源:BrowserTest.cs

示例2: logging_in_with_no_credentials_displays_validation_error

        public void logging_in_with_no_credentials_displays_validation_error()
        {
            var capabilities = new DesiredCapabilities();
            capabilities.SetCapability(InternetExplorerDriver.IntroduceInstabilityByIgnoringProtectedModeSettings, true);

            var driver = new InternetExplorerDriver(capabilities);
            driver.Navigate().GoToUrl(TargetAppUrl + "/Authentication/LogOff");

            try
            {
                driver.Navigate().GoToUrl(TargetAppUrl + "/LogOn");

                driver.FindElement(By.TagName("form")).Submit();

                driver.Url.ShouldEqual(TargetAppUrl + "/LogOn");

                driver.FindElements(By.CssSelector("span.field-validation-error[data-valmsg-for=\"EmailAddress\"]")).ShouldNotBeEmpty();
                driver.FindElements(By.CssSelector("span.field-validation-error[data-valmsg-for=\"Password\"]")).ShouldNotBeEmpty();
            }
            finally
            {
                driver.Close();
            }
        }
开发者ID:williamflock,项目名称:Fail-Tracker,代码行数:24,代码来源:AuthenticationSpecs.cs

示例3: Main

        static void Main(string[] args)
        {
            GetUserInfo();

            // Create a new IE driver and navigate to the url
            var ieDriver = new InternetExplorerDriver();
            ieDriver.Navigate().GoToUrl(_listUrl);
            // Wait for the user to log in and go through security concerns
            Console.WriteLine("Please log in to the sharepoint site and wait for it to load, once complete please press enter");
            Console.ReadLine();

            var mainStopwatch = new Stopwatch();
            mainStopwatch.Start();
            Console.WriteLine("Looking at the site");
            // Retreive all of the rows
            var all = ieDriver.FindElements(By.ClassName("ms-itmhover"));

            Console.WriteLine("Found " + all.Count + " applications in " + mainStopwatch.ElapsedMilliseconds + " milliseconds");
            mainStopwatch.Restart();
            // Grab all of the links to the apps
            var allLinks = new string[all.Count];
            var i = 0;
            foreach (IWebElement element in all)
            {
                allLinks[i] = element.FindElement(By.ClassName("ms-vb-title")).FindElement(By.TagName("a")).GetAttribute("href");
                i++;
                Console.WriteLine(i + "/" + all.Count + " Item urls discovered");
            }
            Console.WriteLine("All items urls discovered in " + mainStopwatch.ElapsedMilliseconds + " milliseconds");
            mainStopwatch.Restart();
            GetPageDetails(allLinks, ieDriver, mainStopwatch);
            DownloadObjects();
            SaveToExcel();
            Console.ReadLine();
        }
开发者ID:moverperfect,项目名称:Extract-From-Sharepoint,代码行数:35,代码来源:Program.cs


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