本文整理汇总了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();
}
示例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();
}
}
示例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();
}