Skip to content

Commit e39e518

Browse files
added csharp code for navigation command (SeleniumHQ#1696)[deploy site]
* added csharp code for navigation command * updated csharp code fix * modified package name --------- Co-authored-by: Sri Harsha <[email protected]>
1 parent 568da88 commit e39e518

File tree

5 files changed

+77
-19
lines changed

5 files changed

+77
-19
lines changed
+37-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,43 @@
1+
using System;
12
using Microsoft.VisualStudio.TestTools.UnitTesting;
3+
using OpenQA.Selenium;
4+
using OpenQA.Selenium.Chrome;
25

3-
namespace SeleniumDocs.Interactions
6+
namespace SeleniumDocumentation.SeleniumInteractions
47
{
58
[TestClass]
6-
public class NavigationTest : BaseTest
9+
public class NavigationTest
710
{
11+
[TestMethod]
12+
public void TestNavigationCommands()
13+
{
14+
IWebDriver driver = new ChromeDriver();
15+
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromMilliseconds(500);
16+
17+
//Convenient
18+
driver.Url = "https://selenium.dev";
19+
//Longer
20+
driver.Navigate().GoToUrl("https://selenium.dev");
21+
var title = driver.Title;
22+
Assert.AreEqual("Selenium", title);
23+
24+
//Back
25+
driver.Navigate().Back();
26+
title = driver.Title;
27+
Assert.AreEqual("Selenium", title);
28+
29+
//Forward
30+
driver.Navigate().Forward();
31+
title = driver.Title;
32+
Assert.AreEqual("Selenium", title);
33+
34+
//Refresh
35+
driver.Navigate().Refresh();
36+
title = driver.Title;
37+
Assert.AreEqual("Selenium", title);
38+
39+
//Quit the browser
40+
driver.Quit();
41+
}
842
}
9-
}
43+
}

Diff for: website_and_docs/content/documentation/webdriver/interactions/navigation.en.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ open your website. This can be achieved in a single line:
2121
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L6" >}}
2222
{{< /tab >}}
2323
{{< tab header="CSharp" >}}
24-
driver.Navigate().GoToUrl(@"https://selenium.dev");
24+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L17-L20" >}}
2525
{{< /tab >}}
2626
{{< tab header="Ruby" >}}
2727
driver.navigate.to 'https://selenium.dev'
@@ -50,7 +50,9 @@ Pressing the browser's back button:
5050
{{< tab header="Python" text=true >}}
5151
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L11" >}}
5252
{{< /tab >}}
53-
{{< tab header="CSharp" >}}driver.Navigate().Back();{{< /tab >}}
53+
{{< tab header="CSharp" >}}
54+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L24-L25" >}}
55+
{{< /tab >}}
5456
{{< tab header="Ruby" >}}driver.navigate.back{{< /tab >}}
5557
{{< tab header="JavaScript" text=true >}}
5658
{{< gh-codeblock path="examples/javascript/test/interactions/navigation.spec.js#L24-L25" >}}
@@ -68,7 +70,9 @@ Pressing the browser's forward button:
6870
{{< tab header="Python" text=true >}}
6971
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L15" >}}
7072
{{< /tab >}}
71-
{{< tab header="CSharp" >}}driver.Navigate().Forward();{{< /tab >}}
73+
{{< tab header="CSharp" >}}
74+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L29-L30" >}}
75+
{{< /tab >}}
7276
{{< tab header="Ruby" >}}driver.navigate.forward{{< /tab >}}
7377
{{< tab header="JavaScript" text=true >}}
7478
{{< gh-codeblock path="examples/javascript/test/interactions/navigation.spec.js#L29-L30" >}}
@@ -87,7 +91,9 @@ Refresh the current page:
8791
{{< tab header="Python" text=true >}}
8892
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L19" >}}
8993
{{< /tab >}}
90-
{{< tab header="CSharp" >}}driver.Navigate().Refresh();{{< /tab >}}
94+
{{< tab header="CSharp" >}}
95+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L34-L35" >}}
96+
{{< /tab >}}
9197
{{< tab header="Ruby" >}}driver.navigate.refresh{{< /tab >}}
9298
{{< tab header="JavaScript" text=true >}}
9399
{{< gh-codeblock path="examples/javascript/test/interactions/navigation.spec.js#L34-L35" >}}

Diff for: website_and_docs/content/documentation/webdriver/interactions/navigation.ja.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ aliases: [
2020
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L6" >}}
2121
{{< /tab >}}
2222
{{< tab header="CSharp" >}}
23-
driver.Navigate().GoToUrl(@"https://selenium.dev");
23+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L17-L20" >}}
2424
{{< /tab >}}
2525
{{< tab header="Ruby" >}}
2626
# Convenient way
@@ -51,7 +51,9 @@ driver.navigate().to("https://selenium.dev")
5151
{{< tab header="Python" text=true >}}
5252
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L11" >}}
5353
{{< /tab >}}
54-
{{< tab header="CSharp" >}}driver.Navigate().Back();{{< /tab >}}
54+
{{< tab header="CSharp" >}}
55+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L24-L25" >}}
56+
{{< /tab >}}
5557
{{< tab header="Ruby" >}}driver.navigate.back{{< /tab >}}
5658
{{< tab header="JavaScript" text=true >}}
5759
{{< gh-codeblock path="examples/javascript/test/interactions/navigation.spec.js#L24-L25" >}}
@@ -71,7 +73,9 @@ driver.navigate().to("https://selenium.dev")
7173
{{< tab header="Python" text=true >}}
7274
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L15" >}}
7375
{{< /tab >}}
74-
{{< tab header="CSharp" >}}driver.Navigate().Forward();{{< /tab >}}
76+
{{< tab header="CSharp" >}}
77+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L29-L30" >}}
78+
{{< /tab >}}
7579
{{< tab header="Ruby" >}}driver.navigate.forward{{< /tab >}}
7680
{{< tab header="JavaScript" text=true >}}
7781
{{< gh-codeblock path="examples/javascript/test/interactions/navigation.spec.js#L29-L30" >}}
@@ -91,7 +95,9 @@ driver.navigate().to("https://selenium.dev")
9195
{{< tab header="Python" text=true >}}
9296
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L19" >}}
9397
{{< /tab >}}
94-
{{< tab header="CSharp" >}}driver.Navigate().Refresh();{{< /tab >}}
98+
{{< tab header="CSharp" >}}
99+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L34-L35" >}}
100+
{{< /tab >}}
95101
{{< tab header="Ruby" >}}driver.navigate.refresh{{< /tab >}}
96102
{{< tab header="JavaScript" text=true >}}
97103
{{< gh-codeblock path="examples/javascript/test/interactions/navigation.spec.js#L34-L35" >}}

Diff for: website_and_docs/content/documentation/webdriver/interactions/navigation.pt-br.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ abrir o seu site. Isso pode ser feito em uma única linha, utilize o seguinte co
2121
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L6" >}}
2222
{{< /tab >}}
2323
{{< tab header="CSharp" >}}
24-
driver.Navigate().GoToUrl(@"https://selenium.dev");
24+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L17-L20" >}}
2525
{{< /tab >}}
2626
{{< tab header="Ruby" >}}
2727
# Convenient way
@@ -52,7 +52,9 @@ Pressionando o botão Voltar do navegador:
5252
{{< tab header="Python" text=true >}}
5353
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L11" >}}
5454
{{< /tab >}}
55-
{{< tab header="CSharp" >}}driver.Navigate().Back();{{< /tab >}}
55+
{{< tab header="CSharp" >}}
56+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L24-L25" >}}
57+
{{< /tab >}}
5658
{{< tab header="Ruby" >}}driver.navigate.back{{< /tab >}}
5759
{{< tab header="JavaScript" text=true >}}
5860
{{< gh-codeblock path="examples/javascript/test/interactions/navigation.spec.js#L24-L25" >}}
@@ -70,7 +72,9 @@ Pressionando o botão Avançar do navegador:
7072
{{< tab header="Python" text=true >}}
7173
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L15" >}}
7274
{{< /tab >}}
73-
{{< tab header="CSharp" >}}driver.Navigate().Forward();{{< /tab >}}
75+
{{< tab header="CSharp" >}}
76+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L29-L30" >}}
77+
{{< /tab >}}
7478
{{< tab header="Ruby" >}}driver.navigate.forward{{< /tab >}}
7579
{{< tab header="JavaScript" text=true >}}
7680
{{< gh-codeblock path="examples/javascript/test/interactions/navigation.spec.js#L29-L30" >}}
@@ -89,7 +93,9 @@ Atualizando a página atual:
8993
{{< tab header="Python" text=true >}}
9094
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L19" >}}
9195
{{< /tab >}}
92-
{{< tab header="CSharp" >}}driver.Navigate().Refresh();{{< /tab >}}
96+
{{< tab header="CSharp" >}}
97+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L34-L35" >}}
98+
{{< /tab >}}
9399
{{< tab header="Ruby" >}}driver.navigate.refresh{{< /tab >}}
94100
{{< tab header="JavaScript" text=true >}}
95101
{{< gh-codeblock path="examples/javascript/test/interactions/navigation.spec.js#L34-L35" >}}

Diff for: website_and_docs/content/documentation/webdriver/interactions/navigation.zh-cn.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ aliases: [
2020
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L6" >}}
2121
{{< /tab >}}
2222
{{< tab header="CSharp" >}}
23-
driver.Navigate().GoToUrl(@"https://selenium.dev");
23+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L17-L20" >}}
2424
{{< /tab >}}
2525
{{< tab header="Ruby" >}}
2626
# 简便的方法
@@ -51,7 +51,9 @@ driver.navigate().to("https://selenium.dev")
5151
{{< tab header="Python" text=true >}}
5252
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L11" >}}
5353
{{< /tab >}}
54-
{{< tab header="CSharp" >}}driver.Navigate().Back();{{< /tab >}}
54+
{{< tab header="CSharp" >}}
55+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L24-L25" >}}
56+
{{< /tab >}}
5557
{{< tab header="Ruby" >}}driver.navigate.back{{< /tab >}}
5658
{{< tab header="JavaScript" text=true >}}
5759
{{< gh-codeblock path="examples/javascript/test/interactions/navigation.spec.js#L24-L25" >}}
@@ -69,7 +71,9 @@ driver.navigate().to("https://selenium.dev")
6971
{{< tab header="Python" text=true >}}
7072
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L15" >}}
7173
{{< /tab >}}
72-
{{< tab header="CSharp" >}}driver.Navigate().Forward();{{< /tab >}}
74+
{{< tab header="CSharp" >}}
75+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L29-L30" >}}
76+
{{< /tab >}}
7377
{{< tab header="Ruby" >}}driver.navigate.forward{{< /tab >}}
7478
{{< tab header="JavaScript" text=true >}}
7579
{{< gh-codeblock path="examples/javascript/test/interactions/navigation.spec.js#L29-L30" >}}
@@ -87,7 +91,9 @@ driver.navigate().to("https://selenium.dev")
8791
{{< tab header="Python" text=true >}}
8892
{{< gh-codeblock path="examples/python/tests/interactions/test_navigation.py#L19" >}}
8993
{{< /tab >}}
90-
{{< tab header="CSharp" >}}driver.Navigate().Refresh();{{< /tab >}}
94+
{{< tab header="CSharp" >}}
95+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/NavigationTest.cs#L34-L35" >}}
96+
{{< /tab >}}
9197
{{< tab header="Ruby" >}}driver.navigate.refresh{{< /tab >}}
9298
{{< tab header="JavaScript" text=true >}}
9399
{{< gh-codeblock path="examples/javascript/test/interactions/navigation.spec.js#L34-L35" >}}

0 commit comments

Comments
 (0)