0

When I write the following in console, the function works:

$('.searchProductLoadMore').click();

However, when I try to do this via iMacro, nothing happens and no error is displayed.

I loaded jQuery in iMacro by looking at the following post:

include jQuery into javascript and use it in imacros ?

following is my entire code.

function loadScriptFromURL(url) {
    var request = Components.classes['@mozilla.org/xmlextras/xmlhttprequest;1'].createInstance(Components.interfaces.nsIXMLHttpRequest),
        async = false;
    request.open('GET', url, async);
    request.send();
    if (request.status !== 200) {
        var message = 'an error occurred while loading script at url: ' + url + ', status: ' + request.status;
        iimDisplay(message);
        return false;
    }
    eval(request.response);
    return true;
}
loadScriptFromURL('http://127.0.0.1:8080/jquery.js');
$ = window.$;
JQuery = window.JQuery;
$('.searchProductLoadMore').click();

Would really appreciate any help on this.

Thanks.

Community
  • 1
  • 1

1 Answers1

1

Just try to use this code without loading jQuery:

iimPlayCode("URL GOTO=javascript:{$('.searchProductLoadMore').click();undefined;}");

If nothing happens, read also my comment to the following post: How to load jQuery and Bootstrap within iMacro

Community
  • 1
  • 1
Shugar
  • 5,269
  • 1
  • 9
  • 9
  • Your solution worked. I tried to do it this way but was missing the "undefined;" and macro was actually pasting the value in the address bar of Firefox. Thank you for your solution. – Abdulrab Khan Sep 04 '15 at 15:03