May 19th, 2015

Reusable Code in Your Selenium Scripts

There are two ways that you can (currently) incorporate reusable code into your scripts. The first is by using the File object to store your JavaScript and then read the file content into a variable and use eval() on the variable. The second approach is to use the CSVTable object to store predefined functions and their parameter lists and then import them into strings and finally create Function objects out of them. I'd like to provide a sample of the latter approach since the File/eval method will likely encourage large amounts of JavaScript code that will need to be read in and then evaluated which can be a slow process and might have a negative impact on the monitoring script execution.

Let's Connect

Find out how Neustar can help you succeed in the connected world.

Contact Us   Give us a call 1-855-898-0036