I use click() all the time through the phantomJS engine on page.evaluate() and it works fine. but sometimes it just doesn’t work, I don’t know why.
For example, I'm trying to click a button here
I tried this:
page.evaluate(function() { document.getElementById('recaptcha-verify-button').click(); });
and this:
rect = page.evaluate(function() { return document.getElementById('recaptcha-verify-button').getBoundingClientRect(); }); console.log(rect.left + " " + rect.right); page.sendEvent('mousemove', rect.left + rect.width / 2, rect.top + rect.height / 2); page.sendEvent('mousedown', rect.left + rect.width / 2, rect.top + rect.height / 2); page.sendEvent('mouseup', rect.left + rect.width / 2, rect.top + rect.height / 2)
Both did not work, after click() there was no way out, I tried the same on chrome, although it was the same. Any ideas or suggestions are welcome.
javascript phantomjs
victory
source share