Skip to content

Commit e9c5eb8

Browse files
committed
AI PR feedback
1 parent 35a240e commit e9c5eb8

File tree

7 files changed

+44
-31
lines changed

7 files changed

+44
-31
lines changed

examples/dotnet/SeleniumDocs/Browsers/ChromeTest.cs

+14-10
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,22 @@ public void PrintOutputToConsole()
188188
var stringWriter = new StringWriter();
189189
var originalOutput = Console.Error;
190190
Console.SetError(stringWriter);
191-
192-
driver = new ChromeDriver();
193-
194-
using (var ctx = Log.CreateContext(LogEventLevel.Debug).Handlers.Add(new ConsoleLogHandler()))
191+
try
195192
{
196-
// logs will be emitted to STDERR
197-
driver.Url = "https://www.selenium.dev/selenium/web/blank.html";
193+
driver = new ChromeDriver();
194+
using (var ctx = Log.CreateContext(LogEventLevel.Debug).Handlers.Add(new ConsoleLogHandler()))
195+
{
196+
// logs will be emitted to STDERR
197+
driver.Url = "https://www.selenium.dev/selenium/web/blank.html";
198+
}
199+
200+
Assert.IsTrue(stringWriter.ToString().Contains("get {\"url\":\"https://www.selenium.dev/selenium/web/blank.html\"}"));
201+
}
202+
finally
203+
{
204+
Console.SetError(originalOutput);
205+
stringWriter.Dispose();
198206
}
199-
200-
Assert.IsTrue(stringWriter.ToString().Contains("get {\"url\":\"https://www.selenium.dev/selenium/web/blank.html\"}"));
201-
Console.SetError(originalOutput);
202-
stringWriter.Dispose();
203207
}
204208
}
205209
}

examples/dotnet/SeleniumDocs/Browsers/EdgeTest.cs

+14-10
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,22 @@ public void PrintOutputToConsole()
188188
var stringWriter = new StringWriter();
189189
var originalOutput = Console.Error;
190190
Console.SetError(stringWriter);
191-
192-
driver = new EdgeDriver();
193-
194-
using (var ctx = Log.CreateContext(LogEventLevel.Debug).Handlers.Add(new ConsoleLogHandler()))
191+
try
195192
{
196-
// logs will be emitted to STDERR
197-
driver.Url = "https://www.selenium.dev/selenium/web/blank.html";
193+
driver = new EdgeDriver();
194+
using (var ctx = Log.CreateContext(LogEventLevel.Debug).Handlers.Add(new ConsoleLogHandler()))
195+
{
196+
// logs will be emitted to STDERR
197+
driver.Url = "https://www.selenium.dev/selenium/web/blank.html";
198+
}
199+
200+
Assert.IsTrue(stringWriter.ToString().Contains("get {\"url\":\"https://www.selenium.dev/selenium/web/blank.html\"}"));
201+
}
202+
finally
203+
{
204+
Console.SetError(originalOutput);
205+
stringWriter.Dispose();
198206
}
199-
200-
Assert.IsTrue(stringWriter.ToString().Contains("get {\"url\":\"https://www.selenium.dev/selenium/web/blank.html\"}"));
201-
Console.SetError(originalOutput);
202-
stringWriter.Dispose();
203207
}
204208
}
205209
}

examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs

+12-7
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,21 @@ public void PrintOutputToConsole()
135135
var stringWriter = new StringWriter();
136136
var originalOutput = Console.Error;
137137
Console.SetError(stringWriter);
138+
try
139+
{
140+
using (var ctx = Log.CreateContext(LogEventLevel.Debug).Handlers.Add(new ConsoleLogHandler()))
141+
{
142+
// logs will be emitted to STDERR
143+
_driver = new InternetExplorerDriver();
144+
}
138145

139-
using (var ctx = Log.CreateContext(LogEventLevel.Debug).Handlers.Add(new ConsoleLogHandler()))
146+
Assert.IsTrue(stringWriter.ToString().Contains("Executing command: []: newSession"));
147+
}
148+
finally
140149
{
141-
// logs will be emitted to STDERR
142-
_driver = new InternetExplorerDriver();
150+
Console.SetError(originalOutput);
151+
stringWriter.Dispose();
143152
}
144-
145-
Assert.IsTrue(stringWriter.ToString().Contains("Executing command: []: newSession"));
146-
Console.SetError(originalOutput);
147-
stringWriter.Dispose();
148153
}
149154
}
150155
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ Property value: `DriverService.LOG_STDOUT` or `DriverService.LOG_STDERR`
553553
{{< gh-codeblock path="examples/python/tests/browsers/test_internet_explorer.py#L109-L111" >}}
554554
{{< /tab >}}
555555
{{< tab header="CSharp" >}}
556-
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs#L139-L143" >}}
556+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs#L140-L144" >}}
557557
{{< /tab >}}
558558
{{< tab header="Ruby" >}}
559559
{{< badge-version version="4.10" >}}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ Property value: `DriverService.LOG_STDOUT` or `DriverService.LOG_STDERR`
541541
{{< gh-codeblock path="examples/python/tests/browsers/test_internet_explorer.py#L109-L111" >}}
542542
{{< /tab >}}
543543
{{< tab header="CSharp" >}}
544-
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs#L139-L143" >}}
544+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs#L140-L144" >}}
545545
{{< /tab >}}
546546
{{< tab header="Ruby" >}}
547547
{{< badge-version version="4.10" >}}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ Property value: `DriverService.LOG_STDOUT` or `DriverService.LOG_STDERR`
549549
{{< gh-codeblock path="examples/python/tests/browsers/test_internet_explorer.py#L109-L111" >}}
550550
{{< /tab >}}
551551
{{< tab header="CSharp" >}}
552-
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs#L139-L143" >}}
552+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs#L140-L144" >}}
553553
{{< /tab >}}
554554
{{< tab header="Ruby" >}}
555555
{{< badge-version version="4.10" >}}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ Property value: `DriverService.LOG_STDOUT` or `DriverService.LOG_STDERR`
551551
{{< gh-codeblock path="examples/python/tests/browsers/test_internet_explorer.py#L109-L111" >}}
552552
{{< /tab >}}
553553
{{< tab header="CSharp" >}}
554-
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs#L139-L143" >}}
554+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs#L140-L144" >}}
555555
{{< /tab >}}
556556
{{< tab header="Ruby" >}}
557557
{{< badge-version version="4.10" >}}

0 commit comments

Comments
 (0)