edinvnode
edinvnode

Reputation: 3537

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.

Upvotes: 0

Views: 757

Answers (3)

Slawomir
Slawomir

Reputation: 1

This worked for me.
iMacros for Chrome 10.1.1:

EVENT TYPE=KEYDOWN SELECTOR="HTML>BODY" KEY=34
EVENT TYPE=KEYUP SELECTOR="HTML>BODY" KEY=34

Upvotes: 0

dexaf61348
dexaf61348

Reputation: 11

or you can create a .js file and run iMacros from there

and to scroll

iimPlay("CODE:URL GOTO=javascript:window.scrollBy(0,2000)");

Upvotes: 0

edinvnode
edinvnode

Reputation: 3537

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;
        }
    }

Upvotes: 0

Related Questions