0 ×

Execute JavaScript

DeprecatedSelenium Nodes for KNIME version by seleniumnodes.com

Executes JavaScript code in the current frame or window of the selected WebDriver. Data can be transferred between KNIME and the JavaScript code, by specifying a return type for the executed code and/or selecting input columns which provide argument values for the executed code.

Arguments can be accessed within JavaScript code through the arguments array. The following argument and return data types are supported:

JavaScript KNIME
HTML element WebElementValue
Decimal DoubleValue
Non-decimal LongValue
boolean BooleanValue
String and other cases StringValue

In case you need to execute code asynchronously, enable the [asyncCallbackMethod] argument. In this case, the last argument given to the executed code is the callback which signals that the code has finished execution. In case you need to return results from your asynchronous code, provide it as argument to the callback method. For example, the following JavaScript code causes the browser to sleep for five seconds, then the execution continues:

var callback = arguments[arguments.length - 1]; // last argument is callback
window.setTimeout(function() {
  callback(); // invoke the callback to continue execution
}, 5000);

Hint: In case you want to return complex data from your JavaScript code (objects or arrays), you can serialize them as follows and use the return type “String”:

var complexObject = {
  property1: 'foo',
  property2: [ 'bar', 'baz' ],
  property3: 5  
return JSON.stringify(complexObject);

Afterwards, you can make use of KNIME’s String to JSON node to convert the string into a JSON cell.

Timeouts for asynchronous execution can be configured in the Start WebDriver node in the “Timeouts” tab: Script timeout.


Input column which provides the WebDriver(s)
Select columns from the input table or flow variables, which provide arguments for the executed code snippet. The selected entries are available in code in the listed order via the arguments array. Enable the last entry [asyncCallbackMethod] in case you’re running an asynchronous script to be able to signal end of execution.
Return type
The return type of the executed JavaScript code in order to map to an appropriate KNIME type, which will be appended as additional output column. Select “None”, in case the code does not return any value.
Column name
The name of the appended column with the result
JavaScript code
The JavaScript code to execute

Input Ports

Table with a column providing a WebDriver

Output Ports

Same as input table, optionally with an additional column with the return values of each JavaScript execution.

Best Friends (Incoming)

Best Friends (Outgoing)



To use this node in KNIME, install Selenium Nodes for KNIME from the following update site:


A zipped version of the software site can be downloaded here.

You don't know what to do with this link? Read our NodePit Product and Node Installation Guide that explains you in detail how to install nodes to your KNIME Analytics Platform.

Wait a sec! You want to explore and install nodes even faster? We highly recommend our NodePit for KNIME extension for your KNIME Analytics Platform. Browse NodePit from within KNIME, install nodes with just one click and share your workflows with NodePit Space.


You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.