How to call Javascript functions on websites

Share your tips, tricks and favorite iMacros macros, scripts and applications for web automation in general here.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team
Post Reply
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

How to call Javascript functions on websites

Post by Tech Support » Wed Dec 19, 2007 11:13 am

You can use the URL GOTO command to execute Javascript functions on websites. If you do this, please remember to replace space " " with "<SP>".

Example: A simple Javascript bookmarklet to count links:

Code: Select all

javascript:if(frames.length<1){alert('This page has'+document.links.length+' links.')}else{alert('The page has frames!')}
After you replace " " with "<SP>" the command looks like:

Code: Select all

URL GOTO=javascript:if(frames.length<1){alert('This<SP>page<SP>has<SP>'+document.links.length+'<SP>links.')}else{alert('The<SP>page<SP>has<SP>frames!')}
crfutu
Posts: 10
Joined: Fri Oct 17, 2008 8:08 am

Re: How to call Javascript functions on websites

Post by crfutu » Thu Mar 12, 2009 2:57 pm

it's helpful
danieljph
Posts: 5
Joined: Tue Nov 17, 2009 12:57 am

Re: How to call Javascript functions on websites

Post by danieljph » Tue Nov 17, 2009 1:26 am

Dear Tech Support,

Is it possible to pass the document.links.length var onto test.js when it is executed from within iimPlay("CODE:...")? Executing the document.links.length if/else from within test.js returns "The page has frames!" which I believe might be due to the iMacros sidebar. Thanks in advance.
Post Reply