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