本文整理汇总了C#中OpenQA.Selenium.IE.InternetExplorerDriver.Close方法的典型用法代码示例。如果您正苦于以下问题:C# InternetExplorerDriver.Close方法的具体用法?C# InternetExplorerDriver.Close怎么用?C# InternetExplorerDriver.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenQA.Selenium.IE.InternetExplorerDriver
的用法示例。
在下文中一共展示了InternetExplorerDriver.Close方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
//Create an instance of HTTPWatch Controller
Controller control = new Controller();
//Start IE Driver. IE Driver Server is located in C:\\
IWebDriver driver = new InternetExplorerDriver(@"C:\");
// Set a unique initial page title so that HttpWatch can attach to it
string uniqueTitle = Guid.NewGuid().ToString();
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
js.ExecuteScript("document.title = '" + uniqueTitle + "';");
// Attach HttpWatch to the instance of Internet Explorer created through WebDriver
Plugin plugin = control.AttachByTitle(uniqueTitle);
//Open the HTTPWatch Window
plugin.OpenWindow(false);
//Navigate to the BMI Application Page
driver.Navigate().GoToUrl("http://dl.dropbox.com/u/55228056/bmicalculator.html");
//Perform some steps
driver.FindElement(By.Id("heightCMS")).SendKeys("181");
driver.FindElement(By.Id("weightKg")).SendKeys("80");
driver.FindElement(By.Id("Calculate")).Click();
//Export the HAR Log generated to a file
plugin.Log.Save(@"C:\bmicalc.hwl");
//Close the Internet Explorer
driver.Close();
}
示例2: when_logging_in_with_an_invalid_username_and_password
public void when_logging_in_with_an_invalid_username_and_password()
{
var capabilities = new DesiredCapabilities();
capabilities.SetCapability(InternetExplorerDriver.IntroduceInstabilityByIgnoringProtectedModeSettings, true);
var driver = new InternetExplorerDriver(capabilities);
try
{
driver.Navigate().GoToUrl("http://localhost:52125/Account/LogOn");
driver.FindElement(By.Name("UserName")).SendKeys("[email protected]");
driver.FindElement(By.Name("Password")).SendKeys("BadPass");
driver.FindElement(By.TagName("form")).Submit();
driver.Url.ShouldEqual("http://localhost:52125/Account/LogOn");
driver.FindElement(By.ClassName("validation-summary-errors")).Text.ShouldContain(
"The user name or password provided is incorrect.");
}
finally
{
driver.Close();
}
}
示例3: Main
static void Main(string[] args)
{
try
{
var stopWatch = Stopwatch.StartNew();
DesiredCapabilities capabilities = new DesiredCapabilities();
var driverService = ChromeDriverService.CreateDefaultService(@"E:\");
driverService.HideCommandPromptWindow = true;
var webDriver = new InternetExplorerDriver();
webDriver.Navigate().GoToUrl("http://www.udebug.com/UVa/10812");
IWebElement inputBox = webDriver.FindElement(By.Id("edit-input-data"));
inputBox.SendKeys("3\n2035415231 1462621774\n1545574401 1640829072\n2057229440 1467906174");
IWebElement submitButton = webDriver.FindElement(By.Id("edit-output"));
submitButton.SendKeys("\n");
submitButton.Click();
string answer = webDriver.PageSource;
int begin = answer.IndexOf("<pre>") + 5;
answer = answer.Substring(begin, answer.IndexOf("</pre>") - begin);
Console.WriteLine(answer);
webDriver.Close();
Console.WriteLine(stopWatch.ElapsedMilliseconds);
}
catch (Exception exception)
{
Console.WriteLine(exception.Message);
}
}
示例4: logging_in_with_invalid_credentials
public void logging_in_with_invalid_credentials()
{
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.Name("EmailAddress")).SendKeys("[email protected]");
driver.FindElement(By.Name("Password")).SendKeys("BadPass");
driver.FindElement(By.TagName("form")).Submit();
driver.Url.ShouldEqual(TargetAppUrl + "/LogOn");
driver.FindElement(By.ClassName("validation-summary-errors")).Text.ShouldContain(
"The user name or password provided is incorrect.");
}
finally
{
driver.Close();
}
}
示例5: ShouldBeAbleToCallQuitAfterCallingCloseOnOnlyOpenWindow
public void ShouldBeAbleToCallQuitAfterCallingCloseOnOnlyOpenWindow()
{
EnvironmentManager.Instance.CloseCurrentDriver();
IWebDriver testDriver = new InternetExplorerDriver();
testDriver.Url = simpleTestPage;
testDriver.Close();
testDriver.Quit();
testDriver = new InternetExplorerDriver();
testDriver.Url = xhtmlTestPage;
Assert.AreEqual("XHTML Test Page", testDriver.Title);
testDriver.Quit();
}
示例6: ShouldNotBeAbleToCallDriverMethodAfterCallingCloseOnOnlyOpenWindow
public void ShouldNotBeAbleToCallDriverMethodAfterCallingCloseOnOnlyOpenWindow()
{
EnvironmentManager.Instance.CloseCurrentDriver();
IWebDriver testDriver = new InternetExplorerDriver();
try
{
testDriver.Url = simpleTestPage;
testDriver.Close();
string url = testDriver.Url;
// Should never reach this line.
Assert.AreEqual(string.Empty, url);
}
catch (WebDriverException)
{
}
finally
{
testDriver.Dispose();
}
}
示例7: when_logging_in_with_a_valid_username_and_password
public void when_logging_in_with_a_valid_username_and_password()
{
var options = new InternetExplorerOptions { IntroduceInstabilityByIgnoringProtectedModeSettings = true };
var driver = new InternetExplorerDriver(options);
try
{
driver.Navigate().GoToUrl("http://localhost:52125/Account/LogOn");
driver.FindElement(By.Name("UserName")).SendKeys("[email protected]");
driver.FindElement(By.Name("Password")).SendKeys("RealPassword");
driver.FindElement(By.TagName("form")).Submit();
driver.Url.ShouldEqual("http://localhost:52125/");
}
finally
{
driver.Close();
}
}
示例8: 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();
}
}
示例9: logging_in_with_valid_credentials_redirects_to_the_dashboard
public void logging_in_with_valid_credentials_redirects_to_the_dashboard()
{
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.Name("EmailAddress")).SendKeys("[email protected]");
driver.FindElement(By.Name("Password")).SendKeys("TestPassword01");
driver.FindElement(By.TagName("form")).Submit();
driver.Url.ShouldEqual(TargetAppUrl + "/");
}
finally
{
driver.Close();
}
}
示例10: unauthorized_user_cannot_access_dashboard
public void unauthorized_user_cannot_access_dashboard()
{
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 + "/Dashboard");
driver.Url.ShouldEqual(TargetAppUrl + "/LogOn?ReturnUrl=%2fDashboard");
}
finally
{
driver.Close();
}
}