I'm trying to click a button on a website using phantomjs. This is the code.
var page = require('webpage').create();
page.open("https://grandorder.gamepress.gg/summon-simulator#1", function(status) {
console.log('Opening page.');
if(status === "success") {
console.log('Opening Successful');
console.log('Pressing button');
document.querySelector("button[id='summon-button']").click();
console.log('Pressed Button.');
phantom.exit();
}
});
The output is:
Opening page.
Opening successful
Pressing button
And it stays there, it never moves to the final log. What am I doing wrong?