imacros

Imacros copy and paste from box


im using imacros I want to do a copy from <div class="captcha-w">43959</div>

then paste it to captcha box (TAG POS=1 TYPE=INPUT:NUMBER ATTR=ID:captcha CONTENT=43959)

TAG POS=2 TYPE=DIV ATTR=TXT:43959
TAG POS=1 TYPE=INPUT:NUMBER ATTR=ID:captcha CONTENT=43959

I want to copy the captcha code


Solution

  • This is a "typical" use case for the EXTRACT Command/Mechanism:

    'Extract Captcha:
    'TAG POS=2 TYPE=DIV ATTR=TXT:43959 // (Recorded)
    SET !EXTRACT NULL
    TAG POS=1 TYPE=DIV ATTR=CLASS:"captcha-w"&&TXT:* EXTRACT=TXT
    
    'Paste Captcha into Input Field:
    'TAG POS=1 TYPE=INPUT:NUMBER ATTR=ID:captcha CONTENT=43959 // (Recorded)
    TAG POS=1 TYPE=INPUT:NUMBER ATTR=ID:captcha CONTENT={{!EXTRACT}}
    

    I can't be sure about the TAG POS=1 for the Extract without being able to test on the Page/Site; if that's not correct, you may have to try with TAG POS=2, TAG POS=3, etc..., or to use 'Relative Positioning' to lower the POS Value to "R1".