本文整理汇总了C#中OpenQA.Selenium.IE.InternetExplorerDriver.Navigate方法的典型用法代码示例。如果您正苦于以下问题:C# InternetExplorerDriver.Navigate方法的具体用法?C# InternetExplorerDriver.Navigate怎么用?C# InternetExplorerDriver.Navigate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenQA.Selenium.IE.InternetExplorerDriver
的用法示例。
在下文中一共展示了InternetExplorerDriver.Navigate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
}
示例2: 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();
}
示例3: Should_page_through_items_in_IE
public void Should_page_through_items_in_IE()
{
IWebDriver ieDriver = new InternetExplorerDriver();
ieDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
ieDriver.Navigate().GoToUrl("http://localhost:1392/");
Login(ieDriver);
ieDriver.FindElement(By.LinkText("Orders")).Click();
for (int i = 0; i < 20; i++)
{
IWebElement nextButton = ieDriver.FindElement(By.Id("ContentPlaceHolder1_GridView1_ctl00_ImageButtonNext"));
nextButton.Click();
IWebElement pageCount = ieDriver.FindElement(By.Id("ContentPlaceHolder1_GridView1_ctl00_TextBoxPage"));
int pageNumber = int.Parse(pageCount.GetAttribute("value"));
Assert.AreEqual(i + 2, pageNumber);
}
ieDriver.FindElement(By.Id("LoginStatus1")).Click();
ieDriver.Quit();
}
示例4: 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();
}
}
示例5: 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);
}
}
示例6: GivenUserOpensMessagesSectionOnVKWebsite
public void GivenUserOpensMessagesSectionOnVKWebsite()
{
IWebDriver driver = new InternetExplorerDriver();
ScenarioContext.Current.Add("driver", driver);
driver.Navigate().GoToUrl("http://vk.com/im");
}
示例7: OpenGoogle
public void OpenGoogle()
{
IWebDriver driver = new InternetExplorerDriver();
//IWebDriver driver = new FirefoxDriver();
driver.Navigate().GoToUrl("http://www.google.com/");
IWebElement query = driver.FindElement(By.Name("q"));
query.SendKeys("Cheese");
System.Console.WriteLine("Page title is: " + driver.Title);
// TODO add wait
driver.Quit();
}
示例8: crawlPartsbase
private static void crawlPartsbase()
{
IWebDriver driver = new InternetExplorerDriver(@"F:\IEDriverServer_x64_2.46.0");
driver.Navigate().GoToUrl("http://www.partsbase.com/landing/login.asp");
var usernameField = driver.FindElement(By.Name("username"));
usernameField.SendKeys("tallaadmin");
var passwdField = driver.FindElement(By.Name("password"));
passwdField.SendKeys("Ta11a2015!");
var submitBtn = driver.FindElement(By.XPath("//a[@class='btn btn-success' and @value='Log In']"));
submitBtn.Click();
}
示例9: GetPageDetails
static void GetPageDetails(string[] allLinks, InternetExplorerDriver ieDriver, Stopwatch sw)
{
for (var i = 0; i < allLinks.Length; i++)
{
Console.WriteLine("Checking item no " + (i+1) + "/" + allLinks.Length);
ieDriver.Navigate().GoToUrl(allLinks[i]);
Thread.Sleep(1000);
var tempApp = new AppDetail(ieDriver);
Applications.Add(tempApp);
Console.WriteLine("Checked URL in a total of " + sw.ElapsedMilliseconds + " milliseconds, eta for rest is " + sw.ElapsedMilliseconds*(allLinks.Length-(i+1)));
sw.Restart();
}
Console.WriteLine("Retreived data from all items");
}
示例10: 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();
}
}
示例11: CrawlILSmart
//tallaadmin
//Ta11a2015!
private static void CrawlILSmart()
{
IWebDriver driver = new InternetExplorerDriver(@"F:\IEDriverServer_x64_2.46.0");
driver.Navigate().GoToUrl("http://static.ilsmart.com/pages/ILSLogin2014.htm?TabId=56&language=en-US");
//<iframe src="http://static.ilsmart.com/pages/ILSLogin2014.htm?TabId=56&language=en-US" frameborder="0" style="width: 620px; height: 100px;" scrolling="no"></iframe>
// <input tabindex="3" class="btn btn-primary btn-sm enter" type="submit" alt="Enter" value="Enter">
var usernameField = driver.FindElement(By.Name("username"));
usernameField.SendKeys("c08hu01");
var passwdField = driver.FindElement(By.Name("password"));
passwdField.SendKeys("Ta11a2015%");
var submitBtn = driver.FindElement(By.XPath("//input[@type='submit' and @value='Enter']"));
submitBtn.Click();
}
示例12: Main
static void Main(string[] args)
{
IWebDriver driver = new InternetExplorerDriver();
driver.Navigate().GoToUrl("http://www.google.com");
IWebElement query = driver.FindElement(By.Name("q"));
query.SendKeys("google test");
query.Submit();
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(t => t.Title.ToLower().StartsWith("google test"));
System.Console.WriteLine(string.Format("Page title is: {0}", driver.Title));
driver.Quit();
}
示例13: 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();
}
}
示例14: Run
static TimeSpan Run(int times, bool enable)
{
var url = "http://localhost:52374/Home/Index";
if (!enable)
{
url += "?enableTurbolinks=false";
}
Action<IFindsByLinkText> click = c => c.FindElementByLinkText("next").Click();
using (var browser = new InternetExplorerDriver(
new InternetExplorerOptions
{
IntroduceInstabilityByIgnoringProtectedModeSettings = true,
IgnoreZoomLevel = true,
EnsureCleanSession = true
}))
{
browser.Navigate().GoToUrl(url);
// Warm up
click(browser);
var watch = new Stopwatch();
watch.Start();
for (var i = 0; i < times; i++)
{
click(browser);
}
watch.Stop();
return watch.Elapsed;
}
}
示例15: 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();
}