Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Use custom click() function for PhantomJS < 2
Browse files Browse the repository at this point in the history
  • Loading branch information
bperel committed Oct 18, 2016
1 parent abe7f98 commit 1c0ebb2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function scrape(integrationName) {
console.log("[Integration][" + integrationName + "] Fetching next show dates...");
var stateBeforeNextDaysClick = this.evaluate(function () {
var stateBeforeNextDaysClick = integration.getNextDaysPaginationMarker();
integration.getElementForNextDays().click();
click(integration.getElementForNextDays());

return stateBeforeNextDaysClick;
});
Expand Down
13 changes: 13 additions & 0 deletions integrations/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,17 @@ function getTimeZonedTime(date, timezone) {
m.add(1, "hour");
}
return m;
}

function click(el){ // For PhantomJS < 2
var ev = document.createEvent("MouseEvent");
ev.initMouseEvent(
"click",
true /* bubble */, true /* cancelable */,
window, null,
0, 0, 0, 0, /* coordinates */
false, false, false, false, /* modifier keys */
0 /*left*/, null
);
el.dispatchEvent(ev);
}

0 comments on commit 1c0ebb2

Please sign in to comment.