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

Method UnpinScript

dotnet/src/webdriver/JavaScriptEngine.cs:248–258  ·  view source on GitHub ↗

Unpins a previously pinned script from the browser. The object to unpin. A task that represents the asynchronous operation. If is .

(PinnedScript script)

Source from the content-addressed store, hash-verified

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

Calls 5

ThrowIfNullMethod · 0.80
MakeRemovalScriptMethod · 0.80
EvaluateMethod · 0.45
RemoveMethod · 0.45