I have been on this for the past two days and tried different methods of clicking. I need to wait for the page to load and then simulate a click. I use:
waitForKeyElements (".button.bbutton.unbind_later", clickOnFollowButton);
function clickOnFollowButton (jNode) {
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('click', true, true);
jNode[0].dispatchEvent (clickEvent);
}
The simulated click returns what I believe is a JSON array displayed in a blank new page. Example:
{"t_ref":"KL26208","price":"1.77","display":"<div class=\"confirm_wrapper\">\n <h4>Tconfirmation</h4>....."}
But when I click manually, I stay on the same page. Part of the page displays a confirmation /thank you message (the page is not reloaded and no new (blank) page when I click manually).
Do I have to parse some data to the click event? How can I simulate the manual click?
The event handler
// =====chrome inspect elements snippet ======
handler: function (e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)}
arguments: null
caller: null
elem: button.bbutton.unbind_later
length: 1
name: ""
prototype: Object
constructor: function (e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)}
__proto__: Object
__proto__: function Empty() {}