Unpins a previously pinned script from the browser. The object to unpin. A task that represents the asynchronous operation. If is .
(PinnedScript script)
| 246 | /// <returns>A task that represents the asynchronous operation.</returns> |
| 247 | /// <exception cref="ArgumentNullException">If <paramref name="script"/> is <see langword="null"/>.</exception> |
| 248 | public async Task UnpinScript(PinnedScript script) |
| 249 | { |
| 250 | ArgumentNullException.ThrowIfNull(script); |
| 251 | |
| 252 | if (this.pinnedScripts.ContainsKey(script.Handle)) |
| 253 | { |
| 254 | await this.session.Value.Domains.JavaScript.Evaluate(script.MakeRemovalScript()).ConfigureAwait(false); |
| 255 | await this.session.Value.Domains.JavaScript.RemoveScriptToEvaluateOnNewDocument(script.ScriptId).ConfigureAwait(false); |
| 256 | this.pinnedScripts.Remove(script.Handle); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | /// <summary> |
| 261 | /// Asynchronously adds a binding to a callback method that will raise an event when the named |