Class JavaScript
Class representing the browser's JavaScript execution as referenced by the DevTools Protocol.
public abstract class JavaScript
- Inheritance
-
JavaScript
- Derived
- Inherited Members
Methods
AddBinding(string)
Adds a binding to a specific JavaScript name.
public abstract Task AddBinding(string name)
Parameters
name
stringThe name to which to bind to.
Returns
- Task
A task that represents the asynchronous operation.
AddScriptToEvaluateOnNewDocument(string)
Adds a JavaScript snippet to evaluate when a new document is opened.
public abstract Task<string> AddScriptToEvaluateOnNewDocument(string script)
Parameters
script
stringThe script to add to be evaluated when a new document is opened.
Returns
- Task<string>
A task that represents the asynchronous operation. The task result contains the internal ID of the script.
DisablePage()
Asynchronously disables the Page domain in the DevTools Protocol.
public abstract Task DisablePage()
Returns
- Task
A task that represents the asynchronous operation.
DisableRuntime()
Asynchronously disables the Runtime domain in the DevTools Protocol.
public abstract Task DisableRuntime()
Returns
- Task
A task that represents the asynchronous operation.
EnablePage()
Asynchronously enables the Page domain in the DevTools Protocol.
public abstract Task EnablePage()
Returns
- Task
A task that represents the asynchronous operation.
EnableRuntime()
Asynchronously enables the Runtime domain in the DevTools Protocol.
public abstract Task EnableRuntime()
Returns
- Task
A task that represents the asynchronous operation.
OnBindingCalled(BindingCalledEventArgs)
Raises the BindingCalled event.
protected virtual void OnBindingCalled(BindingCalledEventArgs e)
Parameters
e
BindingCalledEventArgsAn BindingCalledEventArgs that contains the event data.
OnConsoleApiCalled(ConsoleApiCalledEventArgs)
Raises the ConsoleApiCalled event.
protected virtual void OnConsoleApiCalled(ConsoleApiCalledEventArgs e)
Parameters
e
ConsoleApiCalledEventArgsAn ConsoleApiCalledEventArgs that contains the event data.
OnExceptionThrown(ExceptionThrownEventArgs)
Raises the ExceptionThrown event.
protected virtual void OnExceptionThrown(ExceptionThrownEventArgs e)
Parameters
e
ExceptionThrownEventArgsAn ExceptionThrownEventArgs that contains the event data.
RemoveBinding(string)
Removes a binding from a specific JavaScript name.
public abstract Task RemoveBinding(string name)
Parameters
name
stringThe name to which to remove the bind from.
Returns
- Task
A task that represents the asynchronous operation.
RemoveScriptToEvaluateOnNewDocument(string)
Removes a JavaScript snippet from evaluate when a new document is opened.
public abstract Task RemoveScriptToEvaluateOnNewDocument(string scriptId)
Parameters
scriptId
stringThe ID of the script to be removed.
Returns
- Task
A task that represents the asynchronous operation.
Events
BindingCalled
Occurs when a JavaScript script binding is called.
public event EventHandler<BindingCalledEventArgs> BindingCalled
Event Type
ConsoleApiCalled
Occurs when the browser's JavaScript console API is called.
public event EventHandler<ConsoleApiCalledEventArgs> ConsoleApiCalled
Event Type
ExceptionThrown
Occurs when a JavaScript exception is thrown.
public event EventHandler<ExceptionThrownEventArgs> ExceptionThrown