3
以下的硒-1正常工作:
什麼是get_eval相當於硒webdriver的Python中
sel = self.selenium
sel.get_eval("window.$('body form div ul li').html()")
當我嘗試在同一Python中硒webdriver的2,我得到一個錯誤。
wd = webdriver.Firefox()
wd.execute_script("window.$('body form div ul li').html()")
selenium.webdriver.common.exceptions.WebDriverException: window.$ is not a function
如何讓jquery在python中的webdriver中工作?
能夠解決這個問題。我錯過了execute_script中的返回。 wd.execute_script(「return window。$('body form div ul li')。html()」) – user652124 2011-03-10 00:48:25
回答你自己的問題並接受它是可以的。如果你這樣做,找到正確的答案會更容易。 – 2011-10-01 16:34:15