Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e2c6c96

Browse files
Adding c# code sample for listening console.log events replaces #722 [deploy site]
1 parent aa6ffc1 commit e2c6c96

File tree

9 files changed

+172
-10
lines changed

9 files changed

+172
-10
lines changed

‎website_and_docs/content/documentation/support_packages/chrome_devtools.de.md‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,26 @@ public void consoleLogTest() {
325325
{{< tab header="Python" >}}
326326
# Please raise a PR to add code sample
327327
{{< /tab >}}
328-
{{< tab header="CSharp" >}}
329-
# Please raise a PR to add code sample
328+
{{< tab header="CSharp" >}}
329+
using OpenQA.Selenium.Chrome;
330+
using OpenQA.Selenium.DevTools;
331+
using System;
332+
using DevToolsSessionDomains = OpenQA.Selenium.DevTools.V91.DevToolsSessionDomains;
333+
334+
namespace Selenium4Sample {
335+
public class Example {
336+
public void ConsoleLogTest() {
337+
var driver = new ChromeDriver();
338+
var devToolsSessionDomains = ((IDevTools) driver).GetDevToolsSession()
339+
.GetVersionSpecificDomains < DevToolsSessionDomains > ();
340+
devToolsSessionDomains.Log.Enable();
341+
devToolsSessionDomains.Log.EntryAdded += (sender, e) => {
342+
Console.WriteLine("log: " + e.Entry.Text);
343+
Console.WriteLine("level: " + e.Entry.Level);
344+
};
345+
}
346+
}
347+
}
330348
{{< /tab >}}
331349
{{< tab header="Ruby" >}}
332350
# Please raise a PR to add code sample

‎website_and_docs/content/documentation/support_packages/chrome_devtools.en.md‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,25 @@ public void consoleLogTest() {
317317
# Please raise a PR to add code sample
318318
{{< /tab >}}
319319
{{< tab header="CSharp" >}}
320-
# Please raise a PR to add code sample
320+
using OpenQA.Selenium.Chrome;
321+
using OpenQA.Selenium.DevTools;
322+
using System;
323+
using DevToolsSessionDomains = OpenQA.Selenium.DevTools.V91.DevToolsSessionDomains;
324+
325+
namespace Selenium4Sample {
326+
public class Example {
327+
public void ConsoleLogTest() {
328+
var driver = new ChromeDriver();
329+
var devToolsSessionDomains = ((IDevTools) driver).GetDevToolsSession()
330+
.GetVersionSpecificDomains < DevToolsSessionDomains > ();
331+
devToolsSessionDomains.Log.Enable();
332+
devToolsSessionDomains.Log.EntryAdded += (sender, e) => {
333+
Console.WriteLine("log: " + e.Entry.Text);
334+
Console.WriteLine("level: " + e.Entry.Level);
335+
};
336+
}
337+
}
338+
}
321339
{{< /tab >}}
322340
{{< tab header="Ruby" >}}
323341
# Please raise a PR to add code sample

‎website_and_docs/content/documentation/support_packages/chrome_devtools.es.md‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,25 @@ public void consoleLogTest() {
326326
# Please raise a PR to add code sample
327327
{{< /tab >}}
328328
{{< tab header="CSharp" >}}
329-
# Please raise a PR to add code sample
329+
using OpenQA.Selenium.Chrome;
330+
using OpenQA.Selenium.DevTools;
331+
using System;
332+
using DevToolsSessionDomains = OpenQA.Selenium.DevTools.V91.DevToolsSessionDomains;
333+
334+
namespace Selenium4Sample {
335+
public class Example {
336+
public void ConsoleLogTest() {
337+
var driver = new ChromeDriver();
338+
var devToolsSessionDomains = ((IDevTools) driver).GetDevToolsSession()
339+
.GetVersionSpecificDomains < DevToolsSessionDomains > ();
340+
devToolsSessionDomains.Log.Enable();
341+
devToolsSessionDomains.Log.EntryAdded += (sender, e) => {
342+
Console.WriteLine("log: " + e.Entry.Text);
343+
Console.WriteLine("level: " + e.Entry.Level);
344+
};
345+
}
346+
}
347+
}
330348
{{< /tab >}}
331349
{{< tab header="Ruby" >}}
332350
# Please raise a PR to add code sample

‎website_and_docs/content/documentation/support_packages/chrome_devtools.fr.md‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,25 @@ public void consoleLogTest() {
326326
# Please raise a PR to add code sample
327327
{{< /tab >}}
328328
{{< tab header="CSharp" >}}
329-
# Please raise a PR to add code sample
329+
using OpenQA.Selenium.Chrome;
330+
using OpenQA.Selenium.DevTools;
331+
using System;
332+
using DevToolsSessionDomains = OpenQA.Selenium.DevTools.V91.DevToolsSessionDomains;
333+
334+
namespace Selenium4Sample {
335+
public class Example {
336+
public void ConsoleLogTest() {
337+
var driver = new ChromeDriver();
338+
var devToolsSessionDomains = ((IDevTools) driver).GetDevToolsSession()
339+
.GetVersionSpecificDomains < DevToolsSessionDomains > ();
340+
devToolsSessionDomains.Log.Enable();
341+
devToolsSessionDomains.Log.EntryAdded += (sender, e) => {
342+
Console.WriteLine("log: " + e.Entry.Text);
343+
Console.WriteLine("level: " + e.Entry.Level);
344+
};
345+
}
346+
}
347+
}
330348
{{< /tab >}}
331349
{{< tab header="Ruby" >}}
332350
# Please raise a PR to add code sample

‎website_and_docs/content/documentation/support_packages/chrome_devtools.ja.md‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,25 @@ devTools.createSession();
315315
# Please raise a PR to add code sample
316316
{{< /tab >}}
317317
{{< tab header="CSharp" >}}
318-
# Please raise a PR to add code sample
318+
using OpenQA.Selenium.Chrome;
319+
using OpenQA.Selenium.DevTools;
320+
using System;
321+
using DevToolsSessionDomains = OpenQA.Selenium.DevTools.V91.DevToolsSessionDomains;
322+
323+
namespace Selenium4Sample {
324+
public class Example {
325+
public void ConsoleLogTest() {
326+
var driver = new ChromeDriver();
327+
var devToolsSessionDomains = ((IDevTools) driver).GetDevToolsSession()
328+
.GetVersionSpecificDomains < DevToolsSessionDomains > ();
329+
devToolsSessionDomains.Log.Enable();
330+
devToolsSessionDomains.Log.EntryAdded += (sender, e) => {
331+
Console.WriteLine("log: " + e.Entry.Text);
332+
Console.WriteLine("level: " + e.Entry.Level);
333+
};
334+
}
335+
}
336+
}
319337
{{< /tab >}}
320338
{{< tab header="Ruby" >}}
321339
# Please raise a PR to add code sample

‎website_and_docs/content/documentation/support_packages/chrome_devtools.ko.md‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,25 @@ public void consoleLogTest() {
326326
# Please raise a PR to add code sample
327327
{{< /tab >}}
328328
{{< tab header="CSharp" >}}
329-
# Please raise a PR to add code sample
329+
using OpenQA.Selenium.Chrome;
330+
using OpenQA.Selenium.DevTools;
331+
using System;
332+
using DevToolsSessionDomains = OpenQA.Selenium.DevTools.V91.DevToolsSessionDomains;
333+
334+
namespace Selenium4Sample {
335+
public class Example {
336+
public void ConsoleLogTest() {
337+
var driver = new ChromeDriver();
338+
var devToolsSessionDomains = ((IDevTools) driver).GetDevToolsSession()
339+
.GetVersionSpecificDomains < DevToolsSessionDomains > ();
340+
devToolsSessionDomains.Log.Enable();
341+
devToolsSessionDomains.Log.EntryAdded += (sender, e) => {
342+
Console.WriteLine("log: " + e.Entry.Text);
343+
Console.WriteLine("level: " + e.Entry.Level);
344+
};
345+
}
346+
}
347+
}
330348
{{< /tab >}}
331349
{{< tab header="Ruby" >}}
332350
# Please raise a PR to add code sample

‎website_and_docs/content/documentation/support_packages/chrome_devtools.nl.md‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,25 @@ public void consoleLogTest() {
326326
# Please raise a PR to add code sample
327327
{{< /tab >}}
328328
{{< tab header="CSharp" >}}
329-
# Please raise a PR to add code sample
329+
using OpenQA.Selenium.Chrome;
330+
using OpenQA.Selenium.DevTools;
331+
using System;
332+
using DevToolsSessionDomains = OpenQA.Selenium.DevTools.V91.DevToolsSessionDomains;
333+
334+
namespace Selenium4Sample {
335+
public class Example {
336+
public void ConsoleLogTest() {
337+
var driver = new ChromeDriver();
338+
var devToolsSessionDomains = ((IDevTools) driver).GetDevToolsSession()
339+
.GetVersionSpecificDomains < DevToolsSessionDomains > ();
340+
devToolsSessionDomains.Log.Enable();
341+
devToolsSessionDomains.Log.EntryAdded += (sender, e) => {
342+
Console.WriteLine("log: " + e.Entry.Text);
343+
Console.WriteLine("level: " + e.Entry.Level);
344+
};
345+
}
346+
}
347+
}
330348
{{< /tab >}}
331349
{{< tab header="Ruby" >}}
332350
# Please raise a PR to add code sample

‎website_and_docs/content/documentation/support_packages/chrome_devtools.pt-br.md‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,25 @@ public void consoleLogTest() {
326326
# Please raise a PR to add code sample
327327
{{< /tab >}}
328328
{{< tab header="CSharp" >}}
329-
# Please raise a PR to add code sample
329+
using OpenQA.Selenium.Chrome;
330+
using OpenQA.Selenium.DevTools;
331+
using System;
332+
using DevToolsSessionDomains = OpenQA.Selenium.DevTools.V91.DevToolsSessionDomains;
333+
334+
namespace Selenium4Sample {
335+
public class Example {
336+
public void ConsoleLogTest() {
337+
var driver = new ChromeDriver();
338+
var devToolsSessionDomains = ((IDevTools) driver).GetDevToolsSession()
339+
.GetVersionSpecificDomains < DevToolsSessionDomains > ();
340+
devToolsSessionDomains.Log.Enable();
341+
devToolsSessionDomains.Log.EntryAdded += (sender, e) => {
342+
Console.WriteLine("log: " + e.Entry.Text);
343+
Console.WriteLine("level: " + e.Entry.Level);
344+
};
345+
}
346+
}
347+
}
330348
{{< /tab >}}
331349
{{< tab header="Ruby" >}}
332350
# Please raise a PR to add code sample

‎website_and_docs/content/documentation/support_packages/chrome_devtools.zh-cn.md‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,25 @@ devTools.createSession();
314314
# Please raise a PR to add code sample
315315
{{< /tab >}}
316316
{{< tab header="CSharp" >}}
317-
# Please raise a PR to add code sample
317+
using OpenQA.Selenium.Chrome;
318+
using OpenQA.Selenium.DevTools;
319+
using System;
320+
using DevToolsSessionDomains = OpenQA.Selenium.DevTools.V91.DevToolsSessionDomains;
321+
322+
namespace Selenium4Sample {
323+
public class Example {
324+
public void ConsoleLogTest() {
325+
var driver = new ChromeDriver();
326+
var devToolsSessionDomains = ((IDevTools) driver).GetDevToolsSession()
327+
.GetVersionSpecificDomains < DevToolsSessionDomains > ();
328+
devToolsSessionDomains.Log.Enable();
329+
devToolsSessionDomains.Log.EntryAdded += (sender, e) => {
330+
Console.WriteLine("log: " + e.Entry.Text);
331+
Console.WriteLine("level: " + e.Entry.Level);
332+
};
333+
}
334+
}
335+
}
318336
{{< /tab >}}
319337
{{< tab header="Ruby" >}}
320338
# Please raise a PR to add code sample

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /