EDIT: While the original problem is solved, the code fails to actually do anything. Tested in Chrome, it inserts 'hi' into the password box. In Spynner it simply loads the page.
I'm attempting to use Spynner to scrape a website my school uses to provide online timetables. For some reason, I always get the following error:
Run Javascript code: jq("[class^=login-text-box]").val("hi")
Javascript console: ReferenceError: Can't find variable: jq
This is caused by the following code:
import spynner
browser = spynner.Browser()
browser.debug_level = 3;
browser.show()
browser.load("http://web.edval.com.au/#publicaccess")
browser.runjs('_jQuery("[class^=login-text-box]").val("hi")')
browser.close()
I have also tried:
import spynner
browser = spynner.Browser()
browser.debug_level = 3;
browser.jslib = 'jq'
browser.show()
browser.load("http://web.edval.com.au/#publicaccess")
browser.runjs('jq("[class^=login-text-box]").val("hi")')
browser.close()
with an equal lack of success. Pasting the JavaScript command into Chrome's JS Console (after I've injected jQuery) works perfectly.
Please could someone offer some assistance?
Thanks!