I'm trying to learn phantomjs for automatically getting data from a site that's now protected with javascript.
I need to click on a link; as per this question I tried to add the custom function "eventFire" to my phantomjs file, as per this post. But no matter what I've tried it outputs ReferenceError: Can't find variable: eventFire
Could someone please tell me the proper way to do this? because I'm not seeing it, thank you.
I tried copying the function exactly and that didn't work, so I tried this also with the same result:
eventFire = function(el, etype){
if (el.fireEvent) {
(el.fireEvent('on' + etype));
} else {
var evObj = document.createEvent('Events');
evObj.initEvent(etype, true, false);
el.dispatchEvent(evObj);
}
}