All Downloads are FREE. Search and download functionalities are using the official Maven repository.

desc.ExecuteJavascript.txt Maven / Gradle / Ivy

There is a newer version: 1.9
Show newest version
Executes the given JavaScript code.

code may contain multiple statements and the return value of last statement is returned by this keyword.

code may be divided into multiple cells in the test data. In that case, the parts are catenated together without adding spaces.

Note that, by default, the code will be executed in the context of the Selenium object itself, so this will refer to the Selenium object. Use window to refer to the window of your application, e.g. window.document.getElementById('foo').

*Examples:*
| Execute JavaScript | window.my_js_function('arg1', 'arg2') |
| Execute JavaScript | https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js |
| Execute JavaScript | classpath:js/mycode.js |
| Execute JavaScript | alert(arguments[0] + arguments[1] + arguments[2]); | alvin | - | test |

=>

| (1) Executes a javascript code
| (2) Downloads the js, then execute the downloaded code.
| (3) Execute the file from project {{resource/js/mycode.js}}.
| (4) Execute the code, with 3 arguments the {{arguments[0]='alvin'}}, {{arguments[1]='-'}} and  {{arguments[2]='test'}}.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy