Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

Latest commit

 

History

History
34 lines (26 loc) · 1.54 KB

javascript_execution.md

File metadata and controls

34 lines (26 loc) · 1.54 KB

JavaScript Execution

Chromely allows JavaScript execution in C# code via implementaion of IChromelyJavaScriptExecutor. A default implementation is provided but this is can be changed via registration of a custom executor.

For sample execution see - JavaScript Execution.

To register a custom exeuctor:

    var config = DefaultConfiguration.CreateForRuntimePlatform();
    config.JavaScriptExecutor  = new CustomJavaScriptExecutor();

    public class CustomJavaScriptExecutor : IChromelyJavaScriptExecutor
    {
    }

To "Execute" a script on the main frame, a "frameName" is not required. To "Execute" on an iframe a "frameName" is required. To get the "frameName", the developer will have to declare that in the iframe object.

  <iframe id="demoframe" name="alldemoframe" .. />
  </div>

Executing the script on main frame

    var javaScriptExecutor  = new CustomJavaScriptExecutor()
    javaScriptExecutor.Execute(script);

Evaluating the script using a frame name

  var javaScriptExecutor  = new CustomJavaScriptExecutor()
    javaScriptExecutor.Execute("alldemoframe", script);