0

I'm using scriptish. I wanted to write a macro that would click for me. But it only works when I press Run in script editor. Does not work on autoload.

// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js
// @run-at         document-end
// @delay          100
// ==/UserScript==

$('.pagination.pagination-centered li:last a').click();

What could be a reason?
I want to write a script that would go through all available pages by clicking next.

Grzegorz
  • 3,538
  • 4
  • 29
  • 47
  • Are you sure that $('.pagination.pagination-centered li:last a') exists when you marco runs? – Chris Charles Feb 09 '15 at 13:30
  • It does exist. Its generated by html not dynamically. Also delay 200 or 2000 does not change anything. It's still there. Only "Run" button executes command properly. – Grzegorz Feb 09 '15 at 13:31
  • Are you sure that your script is running on load? Can you put some other side effect in there to check. Like an alert just before the click() – Chris Charles Feb 09 '15 at 13:33
  • Adding console.log() after and before .click trigger call behaves like it was only skipping click call. Both log() calls write to console. – Grzegorz Feb 09 '15 at 13:36
  • It seems form's click are disabled and it uses registered event. Can be problem like with http://stackoverflow.com/questions/12146445/jquery-in-greasemonkey-1-0-conflicts-with-websites-using-jquery but gonna test it – Grzegorz Feb 09 '15 at 13:42
  • Nope. Wasn't that. Strange thing is that it works perfectly when pressing "Run". Just like there was some kind of "protection" to pervent from infinite loops. Could try to blame that it's not working at all. But still other function calls execute except that only one. trigger('clik') does not work either – Grzegorz Feb 09 '15 at 13:44

0 Answers0