本文整理汇总了C#中IWebDriver.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# IWebDriver.Dispose方法的具体用法?C# IWebDriver.Dispose怎么用?C# IWebDriver.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWebDriver
的用法示例。
在下文中一共展示了IWebDriver.Dispose方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
WebDriver = (RemoteWebDriver)DriverManager.CreateDriver(Convert.ToString(TestContext.DataRow["browser"]), Convert.ToString(TestContext.DataRow["version"]), Convert.ToString(TestContext.DataRow["platform"]));
WebDriver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromMilliseconds(30000));
WebDriver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromMilliseconds(15000));
WebDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(15000));
WebDriver.Manage().Window.Maximize();
try
{
WebDriver.Navigate().GoToUrl("https://bfc-test.bftcloud.com/our-partners");
}
catch (WebDriverTimeoutException)
{
WebDriver.Dispose();
Assert.Fail("The driver timed out attempting to load the page.");
}
}
示例2: CleanUp
/// <summary>
/// Dispose WebDriver and pushes erros to console from OrderVerifications class
/// </summary>
public void CleanUp(ref IWebDriver driver)
{
MessageConsoleCreator message = new MessageConsoleCreator();
message.DriverDisposed();
driver.Dispose();
}
示例3: TestMethod1
//.........这里部分代码省略.........
//Premiun Sound
//_driver.FindElement(By.Id("r_865")).Click();
//Tow Hitch
//_driver.FindElement(By.Id("r_778")).Click();
//********************* Div Click Down ********
//*************Use Code to as a div drop down
//_driver.FindElement(By.Id("Interior Color")).Click();
//**************Interior Features**********
//IWebElement InteriorColorBlack = _driver.FindElement(By.XPath(".//*[@id='r_4294961961']"));
//InteriorColorBlack.Click();
//IWebElement InteriorColorBlue = _driver.FindElement(By.XPath(".//*[@id='r_4294961959']"));
//InteriorColorBlue.Click();
//IWebElement InteriorColorGrey = _driver.FindElement(By.XPath(".//*[@id='r_4294961965']"));
//InteriorColorGrey.Click();
//IWebElement InteriorColorTan = _driver.FindElement(By.XPath(".//*[@id='r_4294961963']"));
//InteriorColorTan.Click();
//********************* Div Click Down ********
//*************Use Code to as a div drop down
//_driver.FindElement(By.Id("MPG highway")).Click();
//********************MPG Highway*************
//IWebElement MPG15 = _driver.FindElement(By.XPath(".//*[@id='r_275']"));
//MPG15.Click();
//IWebElement MPG20 = _driver.FindElement(By.XPath(".//*[@id='r_276']"));
//MPG20.Click();
//IWebElement MPG25 = _driver.FindElement(By.XPath(".//*[@id='r_277']"));
//MPG25.Click();
//IWebElement MPG30 = _driver.FindElement(By.XPath(".//*[@id='r_278']"));
//MPG30.Click();
//********************* Div Click Down ********
//*************Use Code to as a div drop down
//_driver.FindElement(By.Id("Transmission")).Click();
//********************Transmission*************
//IWebElement auto = _driver.FindElement(By.XPath(".//*[@id='r_282']"));
//auto.Click();
//IWebElement manual = _driver.FindElement(By.XPath(".//*[@id='r_283']"));
//manual.Click();
//*************Mile radius and Area code check boxes************
IWebElement drop = _driver.FindElement(By.Id("dLabel"));
drop.Click();
//************Selected Distance
// Set to 250 miles
_driver.FindElement(By.CssSelector("#distance > li:nth-child(5) > a")).Click();
//*****************testing zip
IWebElement Zip = _driver.FindElement(By.CssSelector("#zip"));
Zip.SendKeys("76504");
Zip.SendKeys(Keys.Enter);
Zip.Click();
_driver.FindElement(By.Id("zip")).Clear();
_driver.FindElement(By.Id("zip")).SendKeys("76504");
//****************Update button
_driver.FindElement(By.Id("distanceSubmit")).Click();
string value = _driver.FindElement(By.CssSelector("#resultsHeader > h1")).Text;
Console.WriteLine(String.Format("{0}", value));
//*************Selects first car in list ********WORKS*****
//_driver.FindElement(By.XPath("//*[@id='resultsList']/div[1]/div[3]/div[1]")).Click();
//Working on this segement
////Working Code to always select $32,998*
//_driver.FindElement(By.Name("//tr[td//a[@value='Select']]/td/a[contains(text(),'$32,998*')]")).Click();
//WebElement PriceLink = _driver.FindElement(By. ("$32,998*"));
//var priceClick = new SelectElement(_driver.FindElement(By.XPath(".//*[@id='r_4294963167']")));
//priceClick.SelectByText("$32,998");
var priceClick = _driver.FindElement(By.XPath(".//*[@id='r_4294963167']"));
// priceClick.Click("32998");
//priceClick.Click("$32,998");
//IWebElement ExteriorColor = _driver.FindElement(By.XPath(".//*[@id='r_4294963167']"));
//ExteriorColor.Click();
//IWebElement Price = _driver.FindElements(By.XPath("//a[contains(text(),'$32,988*')"));
//_driver.FindElement(By.PartialLinkText("//a[contains(text(),'$32,988*')")).Click();
//_driver.FindElement(By.PartialLinkText("//*[contains(text(), '$32,988*')]")).Click();
//****************Checking to see correct cars found*****************
Assert.AreEqual("1 cars found", value);
Console.WriteLine("Executed Test");
_driver.Dispose();
}
示例4: CloseBrowserAndDispose
private static void CloseBrowserAndDispose(IWebDriver driver)
{
driver.Close();
driver.Dispose();
}