I am trying to call a JS function from Phantom JS. The function is actually triggered on clicking a value from select element of the loaded page. This is the closest answer I could get: Call function PhantomJs
Here, the inner HTML is retrieved. But, I just need to call this function and render the page that is loaded after calling this function.
The JS Function is setFilter('2 Days')
and the code in the page is <a class="ng-binding" ng-click="setFilter(span)">2 days</a>
My Code:
window.setTimeout(function () {
page.evaluate(function () {
setRelativeFilter('Last 2d');
});
page.render(output);
phantom.exit();
}, waitTime);
Error : ReferenceError: Can't find variable: setFilter