-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathNavigationTest.cs
43 lines (37 loc) · 1.17 KB
/
NavigationTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace SeleniumDocumentation.SeleniumInteractions
{
[TestClass]
public class NavigationTest
{
[TestMethod]
public void TestNavigationCommands()
{
IWebDriver driver = new ChromeDriver();
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromMilliseconds(500);
//Convenient
driver.Url = "https://selenium.dev";
//Longer
driver.Navigate().GoToUrl("https://selenium.dev");
var title = driver.Title;
Assert.AreEqual("Selenium", title);
//Back
driver.Navigate().Back();
title = driver.Title;
Assert.AreEqual("Selenium", title);
//Forward
driver.Navigate().Forward();
title = driver.Title;
Assert.AreEqual("Selenium", title);
//Refresh
driver.Navigate().Refresh();
title = driver.Title;
Assert.AreEqual("Selenium", title);
//Quit the browser
driver.Quit();
}
}
}