selenium - How to execute jQuery using Selenium2Library under Robot Framework -
i new robot framework,
and want simulate control jquery component via executing jquery
however, selenium2library drives me crazy.
try value of dom component log shows none.
refer http://d.pr/i/kxhw
the following test code.
thanks in advance.
click configuration [tags] xpath open browser http://${host} ie log "123" ${slide val}= execute javascript window.jquery("#gain_slider_handle").val(); ${title}= execute javascript window.$("head title")[0]; ${t2}= execute javascript window.eval('window.document.title') log ${slide val} log ${title}
and try use python same thing via selenium webdriver,
it "none" value .
def setup(self): self.driver = webdriver.ie(r"c:\\bin\\iedriverserver.exe") self.driver.implicitly_wait(10) self.base_url = "http://172.19.1.28/setup/media/sensor.html" self.verificationerrors = [] self.accept_next_alert = true def test_py_robot(self): driver = self.driver driver.get(self.base_url ) print "title:" + str( driver.execute_script("document.title")) print "wdr val:" + str( driver.execute_script("$('#wdr_strength').val()") )
when use jquery selector,you need make sure web loaded jquery package. if without,you can execute javascript
var headid = document.getelementsbytagname(\"head\")[0];var newscript = document.createelement('script');newscript.type='text/javascript';newscript.src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js';headid.appendchild(newscript);
Comments
Post a Comment