Argus9 Argus9 - 1 year ago 178
Ruby Question

Ruby Selenium WebDriver - get return value of execute_script

Simple question here - when I use

in a Ruby Selenium test, is there a way I can get the result of the JavaScript I ran?

This is the code I'm executing:
driver.execute_script '$.active'

Edit: The solution is so simple. I forgot to include
in the script.

Answer Source

You just need to add the return:

driver.execute_script 'return $.active'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download