javascriptfirefoximacros

iMacros JavaScript how to scroll down?


How to scroll down with iMacros and JavaScript. I used this code.

URL GOTO=javascript:window.scrollTo(0,document.body.scrollHeight);

But it doesn't work. I use iMacros 8.9.7 and Pale Moon latest version. It doesn't seem to work no more.


Solution

  • I managed to figure out solution. I placed this code in loop and it scrolled on the page. The key 40 in iMacros is down key. I used pale moon for this and iMacros 8.9.7.

       var macroScroll;
    
        macroScroll = 'CODE:' + jsLF;
        macroScroll += 'SET !ERRORIGNORE YES' + jsLF;
        macroScroll += 'SET !TIMEOUT_PAGE 60' + jsLF;
        macroScroll += 'SET !TIMEOUT_STEP 5' + jsLF;
    
        macroScroll += 'EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>JSL>DIV:nth-of-type(3)>DIV:nth-of-type(9)>DIV:nth-of-type(9)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(10)" KEYS="[40,40]"' + jsLF;
        macroScroll += 'WAIT SECONDS=0' + jsLF;
    
        for (var i = 1; i <= 50; i++) {
    
            ret = iimPlay(macroScroll, 60);
    
            if (ret == -101) {
                break main;
            }
        }