1

I am trying to simulate a click on buttons in this game BattleCry (the site is battlecry.mobi), but I cannot get it to click. I am not sure how to continue. I tried simulating a mouse event and using dispatchEvent, I tried element.click(), and I tried a function for a click I found online. I cannot find any way to make it work. Specifically I am trying to call a click on a mission button.

var evt = document.createEvent("MouseEvents"); 
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
engageBtn.dispatchEvent(evt);

This is one of the things I have tried (engage button is a random missions button).

<a class="x-container doitbutton xbutton" id="ext-xbutton-108">ENGAGE</a>

This is what I need to click.

2
  • From what I have seen battlecry.mobi has jQuery. you could just try simulating a click using the click event on the DOM element api.jquery.com/click
    – Yussuf S
    Dec 9, 2013 at 1:54
  • I tried that, but I don't can't see what function clicking the button is calling and using just .click() does not work.
    – MathMan08
    Dec 9, 2013 at 2:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.