What is the equivalent of get_eval for selenium webdriver in python

The following works fine in selenium-1:

sel = self.selenium 
sel.get_eval("window.$('body form div ul li').html()")

When I try to do the same in selenium-2 webdriver in python, I get an error.

wd = webdriver.Firefox()
wd.execute_script("window.$('body form div ul li').html()")

selenium.webdriver.common.exceptions.WebDriverException: window.$ is not a function

How to get this jquery to work in webdriver in python?

+3
source share
1 answer

In selenium1 get_eval () evaluates the script and returns the result.

When you use execute_script (), you must explicitly return the value you are interested in.

+4
source

All Articles