Skip to content

Commit 21884af

Browse files
[dotnet] Updating examples in documentation (#2346)
* [dotnet] fix example lines in chrome documentation * [dotnet] moved examples from option documentation into accoding cs file * fixed text rendering * updated to consistent formatting in OptionsTest.cs * [dotnet] updated documentation references for ChromeOptions and DriverOptions --------- Co-authored-by: Diego Molina <diemol@users.noreply.github.com> [deploy site]
1 parent a5f0d1f commit 21884af

File tree

9 files changed

+80
-226
lines changed

9 files changed

+80
-226
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,57 @@
11
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
using OpenQA.Selenium;
3+
using OpenQA.Selenium.Chrome;
24

35
namespace SeleniumDocs.Drivers
46
{
57
[TestClass]
68
public class OptionsTest : BaseTest
79
{
10+
[TestMethod]
11+
public void SetPageLoadStrategyNormal()
12+
{
13+
ChromeOptions chromeOptions = new ChromeOptions();
14+
chromeOptions.PageLoadStrategy = PageLoadStrategy.Normal;
15+
IWebDriver driver = new ChromeDriver(chromeOptions);
16+
try
17+
{
18+
// Navigate to Url
19+
driver.Navigate().GoToUrl("https://selenium.dev");
20+
}
21+
finally
22+
{
23+
driver.Quit();
24+
}
25+
}
26+
[TestMethod]
27+
public void SetPageLoadStrategyEager()
28+
{
29+
var chromeOptions = new ChromeOptions();
30+
chromeOptions.PageLoadStrategy = PageLoadStrategy.Eager;
31+
IWebDriver driver = new ChromeDriver(chromeOptions);
32+
try
33+
{
34+
driver.Navigate().GoToUrl("https://selenium.dev");
35+
}
36+
finally
37+
{
38+
driver.Quit();
39+
}
40+
}
41+
[TestMethod]
42+
public void SetPageLoadStrategyNone()
43+
{
44+
var chromeOptions = new ChromeOptions();
45+
chromeOptions.PageLoadStrategy = PageLoadStrategy.None;
46+
IWebDriver driver = new ChromeDriver(chromeOptions);
47+
try
48+
{
49+
driver.Navigate().GoToUrl("https://selenium.dev");
50+
}
51+
finally
52+
{
53+
driver.Quit();
54+
}
55+
}
856
}
957
}

website_and_docs/content/documentation/webdriver/browsers/chrome.en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Add an extension to options:
118118
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L40">}}
119119
{{% /tab %}}
120120
{{< tab header="CSharp" >}}
121-
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L61" >}}
121+
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L62-67" >}}
122122
{{< /tab >}}
123123
{{< tab header="Ruby" >}}
124124
{{< gh-codeblock path="/examples/ruby/spec/browsers/chrome_spec.rb#L38" >}}
@@ -175,7 +175,7 @@ Set excluded arguments on options:
175175
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L62" >}}
176176
{{% /tab %}}
177177
{{< tab header="CSharp" >}}
178-
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L76" >}}
178+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L82" >}}
179179
{{< /tab >}}
180180
{{< tab header="Ruby" >}}
181181
{{< gh-codeblock path="/examples/ruby/spec/browsers/chrome_spec.rb#L57" >}}

website_and_docs/content/documentation/webdriver/browsers/chrome.ja.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ The `extensions` パラメータはcrxファイルを受け入れます。解凍
117117
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L40">}}
118118
{{% /tab %}}
119119
{{< tab header="CSharp" >}}
120-
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L61" >}}
120+
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L62-67" >}}
121121
{{< /tab >}}
122122
{{< tab header="Ruby" >}}
123123
{{< gh-codeblock path="/examples/ruby/spec/browsers/chrome_spec.rb#L36" >}}
@@ -174,7 +174,7 @@ Chrome はさまざまな引数を追加します。
174174
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L62" >}}
175175
{{% /tab %}}
176176
{{< tab header="CSharp" >}}
177-
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L76" >}}
177+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L82" >}}
178178
{{< /tab >}}
179179
{{< tab header="Ruby" >}}
180180
{{< gh-codeblock path="/examples/ruby/spec/browsers/chrome_spec.rb#L53" >}}

website_and_docs/content/documentation/webdriver/browsers/chrome.pt-br.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Adicionar uma extensão:
117117
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L40">}}
118118
{{% /tab %}}
119119
{{< tab header="CSharp" >}}
120-
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L61" >}}
120+
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L62-67">}}
121121
{{< /tab >}}
122122
{{< tab header="Ruby" >}}
123123
{{< gh-codeblock path="/examples/ruby/spec/browsers/chrome_spec.rb#L34" >}}
@@ -176,7 +176,7 @@ Exclua parametros:
176176
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L62" >}}
177177
{{% /tab %}}
178178
{{< tab header="CSharp" >}}
179-
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L76" >}}
179+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L82" >}}
180180
{{< /tab >}}
181181
{{< tab header="Ruby" >}}
182182
{{< gh-codeblock path="/examples/ruby/spec/browsers/chrome_spec.rb#L53" >}}

website_and_docs/content/documentation/webdriver/browsers/chrome.zh-cn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Chrome浏览器的特有功能可以在谷歌的页面找到: [Capabilities & Ch
117117
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L40">}}
118118
{{% /tab %}}
119119
{{< tab header="CSharp" >}}
120-
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L61" >}}
120+
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L62-67" >}}
121121
{{< /tab >}}
122122
{{< tab header="Ruby" >}}
123123
{{< gh-codeblock path="/examples/ruby/spec/browsers/chrome_spec.rb#L34" >}}
@@ -174,7 +174,7 @@ Chrome 添加了各种参数,如果你不希望添加某些参数,可以将
174174
{{< gh-codeblock path="/examples/python/tests/browsers/test_chrome.py#L62" >}}
175175
{{% /tab %}}
176176
{{< tab header="CSharp" >}}
177-
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L76" >}}
177+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs#L82" >}}
178178
{{< /tab >}}
179179
{{< tab header="Ruby" >}}
180180
{{< gh-codeblock path="/examples/ruby/spec/browsers/chrome_spec.rb#L53" >}}

website_and_docs/content/documentation/webdriver/drivers/options.en.md

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,8 @@ event fire is returned.
119119
{{< tab header="Python" text=true >}}
120120
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L7-9">}}
121121
{{< /tab >}}
122-
{{< tab header="CSharp" >}}
123-
using OpenQA.Selenium;
124-
using OpenQA.Selenium.Chrome;
125-
126-
namespace pageLoadStrategy {
127-
class pageLoadStrategy {
128-
public static void Main(string[] args) {
129-
var chromeOptions = new ChromeOptions();
130-
chromeOptions.PageLoadStrategy = PageLoadStrategy.Normal;
131-
IWebDriver driver = new ChromeDriver(chromeOptions);
132-
try {
133-
driver.Navigate().GoToUrl("https://example.com");
134-
} finally {
135-
driver.Quit();
136-
}
137-
}
138-
}
139-
}
122+
{{< tab header="CSharp" text=true >}}
123+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs#L13-14" >}}
140124
{{< /tab >}}
141125
{{< tab header="Ruby" text=true >}}
142126
{{< gh-codeblock path="/examples/ruby/spec/drivers/options_spec.rb#L11-L12">}}
@@ -176,24 +160,8 @@ event fire is returned.
176160
{{< tab header="Python" text=true >}}
177161
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L15-L17">}}
178162
{{< /tab >}}
179-
{{< tab header="CSharp" >}}
180-
using OpenQA.Selenium;
181-
using OpenQA.Selenium.Chrome;
182-
183-
namespace pageLoadStrategy {
184-
class pageLoadStrategy {
185-
public static void Main(string[] args) {
186-
var chromeOptions = new ChromeOptions();
187-
chromeOptions.PageLoadStrategy = PageLoadStrategy.Eager;
188-
IWebDriver driver = new ChromeDriver(chromeOptions);
189-
try {
190-
driver.Navigate().GoToUrl("https://example.com");
191-
} finally {
192-
driver.Quit();
193-
}
194-
}
195-
}
196-
}
163+
{{< tab header="CSharp" text=true >}}
164+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs#L29-30" >}}
197165
{{< /tab >}}
198166
{{< tab header="Ruby" text=true >}}
199167
{{< gh-codeblock path="/examples/ruby/spec/drivers/options_spec.rb#L20-L21">}}
@@ -232,24 +200,8 @@ WebDriver only waits until the initial page is downloaded.
232200
{{< tab header="Python" text=true >}}
233201
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L23-L25">}}
234202
{{< /tab >}}
235-
{{< tab header="CSharp" >}}
236-
using OpenQA.Selenium;
237-
using OpenQA.Selenium.Chrome;
238-
239-
namespace pageLoadStrategy {
240-
class pageLoadStrategy {
241-
public static void Main(string[] args) {
242-
var chromeOptions = new ChromeOptions();
243-
chromeOptions.PageLoadStrategy = PageLoadStrategy.None;
244-
IWebDriver driver = new ChromeDriver(chromeOptions);
245-
try {
246-
driver.Navigate().GoToUrl("https://example.com");
247-
} finally {
248-
driver.Quit();
249-
}
250-
}
251-
}
252-
}
203+
{{< tab header="CSharp" text=true >}}
204+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs#L41-42" >}}
253205
{{< /tab >}}
254206
{{< tab header="Ruby" text=true >}}
255207
{{< gh-codeblock path="/examples/ruby/spec/drivers/options_spec.rb#L29-L30">}}

website_and_docs/content/documentation/webdriver/drivers/options.ja.md

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -115,24 +115,8 @@ WebDriver は [load](https://developer.mozilla.org/ja/docs/Web/API/Window/load_e
115115
{{< tab header="Python" text=true >}}
116116
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L7-9">}}
117117
{{< /tab >}}
118-
{{< tab header="CSharp" >}}
119-
using OpenQA.Selenium;
120-
using OpenQA.Selenium.Chrome;
121-
122-
namespace pageLoadStrategy {
123-
class pageLoadStrategy {
124-
public static void Main(string[] args) {
125-
var chromeOptions = new ChromeOptions();
126-
chromeOptions.PageLoadStrategy = PageLoadStrategy.Normal;
127-
IWebDriver driver = new ChromeDriver(chromeOptions);
128-
try {
129-
driver.Navigate().GoToUrl("https://example.com");
130-
} finally {
131-
driver.Quit();
132-
}
133-
}
134-
}
135-
}
118+
{{< tab header="CSharp" text=true >}}
119+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs#L13-14" >}}
136120
{{< /tab >}}
137121
{{< tab header="Ruby" text=true >}}
138122
{{< gh-codeblock path="/examples/ruby/spec/drivers/options_spec.rb#L11-L12">}}
@@ -171,24 +155,8 @@ WebDriver は、[DOMContentLoaded](https://developer.mozilla.org/ja/docs/Web/API
171155
{{< tab header="Python" text=true >}}
172156
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L15-L17">}}
173157
{{< /tab >}}
174-
{{< tab header="CSharp" >}}
175-
using OpenQA.Selenium;
176-
using OpenQA.Selenium.Chrome;
177-
178-
namespace pageLoadStrategy {
179-
class pageLoadStrategy {
180-
public static void Main(string[] args) {
181-
var chromeOptions = new ChromeOptions();
182-
chromeOptions.PageLoadStrategy = PageLoadStrategy.Eager;
183-
IWebDriver driver = new ChromeDriver(chromeOptions);
184-
try {
185-
driver.Navigate().GoToUrl("https://example.com");
186-
} finally {
187-
driver.Quit();
188-
}
189-
}
190-
}
191-
}
158+
{{< tab header="CSharp" text=true >}}
159+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs#L29-30" >}}
192160
{{< /tab >}}
193161
{{< tab header="Ruby" text=true >}}
194162
{{< gh-codeblock path="/examples/ruby/spec/drivers/options_spec.rb#L20-L21">}}
@@ -226,24 +194,8 @@ WebDriver は、最初のページがダウンロードされるまで待機し
226194
{{< tab header="Python" text=true >}}
227195
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L23-L25">}}
228196
{{< /tab >}}
229-
{{< tab header="CSharp" >}}
230-
using OpenQA.Selenium;
231-
using OpenQA.Selenium.Chrome;
232-
233-
namespace pageLoadStrategy {
234-
class pageLoadStrategy {
235-
public static void Main(string[] args) {
236-
var chromeOptions = new ChromeOptions();
237-
chromeOptions.PageLoadStrategy = PageLoadStrategy.None;
238-
IWebDriver driver = new ChromeDriver(chromeOptions);
239-
try {
240-
driver.Navigate().GoToUrl("https://example.com");
241-
} finally {
242-
driver.Quit();
243-
}
244-
}
245-
}
246-
}
197+
{{< tab header="CSharp" text=true >}}
198+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs#L41-42" >}}
247199
{{< /tab >}}
248200
{{< tab header="Ruby" text=true >}}
249201
{{< gh-codeblock path="/examples/ruby/spec/drivers/options_spec.rb#L29-L30">}}

website_and_docs/content/documentation/webdriver/drivers/options.pt-br.md

Lines changed: 6 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -131,25 +131,8 @@ event fire is returned.
131131
{{< /tab >}}
132132
{{< tab header="Python" text=true >}}
133133
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L7-9">}}
134-
{{< /tab >}}
135-
{{< tab header="CSharp" >}}
136-
using OpenQA.Selenium;
137-
using OpenQA.Selenium.Chrome;
138-
139-
namespace pageLoadStrategy {
140-
class pageLoadStrategy {
141-
public static void Main(string[] args) {
142-
var chromeOptions = new ChromeOptions();
143-
chromeOptions.PageLoadStrategy = PageLoadStrategy.Normal;
144-
IWebDriver driver = new ChromeDriver(chromeOptions);
145-
try {
146-
driver.Navigate().GoToUrl("https://example.com");
147-
} finally {
148-
driver.Quit();
149-
}
150-
}
151-
}
152-
}
134+
{{< /tab >}}{{< tab header="CSharp" text=true >}}
135+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs#L13-14" >}}
153136
{{< /tab >}}
154137
{{< tab header="Ruby" text=true >}}
155138
{{< gh-codeblock path="/examples/ruby/spec/drivers/options_spec.rb#L11-L12">}}
@@ -188,24 +171,8 @@ event fire is returned.
188171
{{< tab header="Python" text=true >}}
189172
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L15-L17">}}
190173
{{< /tab >}}
191-
{{< tab header="CSharp" >}}
192-
using OpenQA.Selenium;
193-
using OpenQA.Selenium.Chrome;
194-
195-
namespace pageLoadStrategy {
196-
class pageLoadStrategy {
197-
public static void Main(string[] args) {
198-
var chromeOptions = new ChromeOptions();
199-
chromeOptions.PageLoadStrategy = PageLoadStrategy.Eager;
200-
IWebDriver driver = new ChromeDriver(chromeOptions);
201-
try {
202-
driver.Navigate().GoToUrl("https://example.com");
203-
} finally {
204-
driver.Quit();
205-
}
206-
}
207-
}
208-
}
174+
{{< tab header="CSharp" text=true >}}
175+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs#L29-30" >}}
209176
{{< /tab >}}
210177
{{< tab header="Ruby" text=true >}}
211178
{{< gh-codeblock path="/examples/ruby/spec/drivers/options_spec.rb#L20-L21">}}
@@ -243,24 +210,8 @@ WebDriver only waits until the initial page is downloaded.
243210
{{< tab header="Python" text=true >}}
244211
{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L23-L25">}}
245212
{{< /tab >}}
246-
{{< tab header="CSharp" >}}
247-
using OpenQA.Selenium;
248-
using OpenQA.Selenium.Chrome;
249-
250-
namespace pageLoadStrategy {
251-
class pageLoadStrategy {
252-
public static void Main(string[] args) {
253-
var chromeOptions = new ChromeOptions();
254-
chromeOptions.PageLoadStrategy = PageLoadStrategy.None;
255-
IWebDriver driver = new ChromeDriver(chromeOptions);
256-
try {
257-
driver.Navigate().GoToUrl("https://example.com");
258-
} finally {
259-
driver.Quit();
260-
}
261-
}
262-
}
263-
}
213+
{{< tab header="CSharp" text=true >}}
214+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Drivers/OptionsTest.cs#L41-42" >}}
264215
{{< /tab >}}
265216
{{< tab header="Ruby" text=true >}}
266217
{{< gh-codeblock path="/examples/ruby/spec/drivers/options_spec.rb#L29-L30">}}

0 commit comments

Comments
 (0)