|
视频地址
补录视频
selenium系列视频3:WebDriver by trumpliu
实例代码:
- using System;
- using System.Collections.Generic;
- using System.Text;
- using OpenQA.Selenium;
- using OpenQA.Selenium.IE;
- using OpenQA.Selenium.Support.UI;
- namespace WebDriver
- {
- class Program
- {
- static void Main(string[] args)
- {
- IWebDriver driver = new InternetExplorerDriver(@"D:\Tools\seleniumWebDriver\IEDriverServer_x64_2.32.3");
- INavigation navigation = driver.Navigate();
- navigation.GoToUrl("http://www.bing.com");
- IWebElement element = driver.FindElement(By.Id("sb_form_go"));
- element.SendKeys("Hello World");
- element.Submit();
- WebDriverWait waiter = new WebDriverWait(driver, TimeSpan.FromSeconds(15));
- bool result = waiter.Until((d) =>
- {
- return d.Title.StartsWith("Hollo World", true, System.Globalization.CultureInfo.CurrentCulture);
- });
- Console.WriteLine(string.Format("the page title is :{0}, result is :{1}",driver.Title,result));
- driver.Quit();
- }
- }
- }
复制代码 |
|