MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / GetLog

Method GetLog

dotnet/src/webdriver/Logs.cs:77–99  ·  view source on GitHub ↗

Gets the set of objects for a specified log. The log for which to retrieve the log entries. Log types can be found in the class. The list of objects for the specified log. If is <see langword="nu

(string logKind)

Source from the content-addressed store, hash-verified

75 /// <returns>The list of <see cref="LogEntry"/> objects for the specified log.</returns>
76 /// <exception cref="ArgumentNullException">If <paramref name="logKind"/> is <see langword="null"/>.</exception>
77 public ReadOnlyCollection<LogEntry> GetLog(string logKind)
78 {
79 ArgumentNullException.ThrowIfNull(logKind);
80
81 List<LogEntry> entries = new List<LogEntry>();
82
83 Dictionary<string, object?> parameters = new Dictionary<string, object?>();
84 parameters.Add("type", logKind);
85 Response commandResponse = this.driver.Execute(DriverCommand.GetLog, parameters);
86
87 if (commandResponse.Value is object?[] responseValue)
88 {
89 foreach (object? rawEntry in responseValue)
90 {
91 if (rawEntry is Dictionary<string, object?> entryDictionary)
92 {
93 entries.Add(LogEntry.FromDictionary(entryDictionary));
94 }
95 }
96 }
97
98 return entries.AsReadOnly();
99 }
100}

Calls 5

ThrowIfNullMethod · 0.80
AddMethod · 0.45
ExecuteMethod · 0.45
FromDictionaryMethod · 0.45
AsReadOnlyMethod · 0.45