Following JS based links

Discussions and Tech Support related to the iMacros Google Chrome extension.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
pangaea
Posts: 1
Joined: Wed Oct 11, 2017 6:08 pm

Following JS based links

Post by pangaea » Wed Oct 11, 2017 6:15 pm

So I am trying to get iMacros to follow a link like this: <a href="#" onclick=(javascript code that sends you to another URL)>(stuff)</a>

So is there any way to do this? Perhaps to extract the onclick code and make it execute somehow?
iimfun
Posts: 239
Joined: Tue Jul 19, 2016 1:06 pm

Re: Following JS based links

Post by iimfun » Tue Oct 17, 2017 6:52 am

Yes. This way may help

Code: Select all

SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=A ATTR=TXT:"(stuff)" EXTRACT=HTM
SET onClick EVAL("'{{!EXTRACT}}'.match(/onclick="(.+?)"/)[1];")
URL GOTO=javascript:{{onClick}}
or even this one

Code: Select all

TAG POS=1 TYPE=A ATTR=TXT:"(stuff)"
Post Reply