is there anyway to make imacro to click this link ? it's dynamic link. so everytime "id=33" will be change.
<span itemprop="name">
<h2>link</h2>
</span>
Preview = http://elakirihub.xyz/new.php
Thanks
Use * character as a wildcard when the last part of the link changes.
Working Example for your case:
TAG POS=1 TYPE=A ATTR=HREF:/story.php?id=*
Since you did not state the environment my example is for iMacros Browser plugin, but the fundamentals apply for iMacros in general.
If you are unsure how to generate the full code before the addition of wildcards you can experiment with recordings or go to the iMacros wiki:
wiki.imacros.net/
Related
I'm trying to make a Imacro script to download multiple photos from Unsplash because I have a project and it's time consuming to download one by one.
So far, I've managed to make the following code. But it skips many images.
VERSION BUILD=8970419 RECORDER=FX
TAB T=1
ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}} WAIT=YES
TAG POS={{!LOOP}} TYPE=A ATTR=HREF:https://unsplash.com/photos/*/download?force=true
Then I found out that the problem is Unsplash doesn't have download?force=true for all images.
Now, what I want is, let it add + download?force=true part after the URL automatically.
To clarify more, this is what I want.
https://unsplash.com/photos/*/ + download?force=true
Thanks in advance.
This should be good enough, I would think:
TAG POS={{!LOOP}} TYPE=A ATTR=HREF:https://unsplash.com/photos/*/*
Only keep the parts that are always there and replace the parts that might be changing or might not be there with *, like you were already doing in /photos/*/....
I want to put text into the input on the page, but it doesn't belong to any valid form. How I can do it?
I tried:
TAG SELECTOR='<selector>' CONTENT='<content>'
and
EVENT TYPE=KEYPRESS SELECTOR="selector" KEYS=[keycodes]
But it doesn't seem to work
First of all,
CSS Selectors are only available in EVENT command with imacros add-on for firefox. But one need iMacros pro v11 to use CSS Selectors in TAG command.
So why cant you just do this
First, use imacros plugin in firefox for this, then go to Record -> Record Options -> Enable Experimental Event Recording Mode.
Then click record button and click the input box where you want to paste, the selector for the input tag will be recorded like so.
EVENT TYPE=MOUSEDOWN SELECTOR="html>body>div:nth-of-type(2)>div:nth-of-type(2)>input" BUTTON=0
Now what you actually need is only the selector address, this will be the path of the input tag where you want to place your text. So next you will paste the selector from the previous step into the below code.
SET !CLIPBOARD "text that is going to be placed in the input tag"
EVENT TYPE=KEYPRESS SELECTOR="html>body>div:nth-of-type(2)>div:nth-of-type(2)>input" CHAR="v" MODIFIERS="ctrl"
So lets check the above code on what is going on.
Line1: We set the clipboard variable of imacros to whatever text you want to insert.
Line2: Then the event tag is going to select the input tag will the selector that we manually inserted, Then we trigger a Ctrl + v through Imacros and the text is gonna get pasted.
I hope my explanation was clear and consise and hope it helped with your issue.
References:
How to select all copy and paste in imacros
How to extract text using CSS Selectors
imacros selector discussion
I know this might seem a lazy question, but I did not find a straight to the point answer yet.
When I type "submit form with imacros" on Google, nothing is clear to me.
And the official iMacros documentation talks about filling forms, but not about submitting them.
I saw that some examples use javascript:
URL GOTO=javascript:window.document.form.submit();
Other examples use CLICK with coordinates.
So, how do you submit forms with iMacros?
The most basic way to submit a form is via the submit button supplied at the page.
The easiest way to do so is to record clicking on it (FireFox iMacro addon -> Record tab -> Record , play with record options only if needed). The output will be saved under #Current.iim and will look like this:
VERSION BUILD=8970419 RECORDER=FX
TAB T=1
URL GOTO=http://demo.imacros.net/Automate/TestForm1
TAG POS=1 TYPE=BUTTON FORM=ACTION:/Automate/FormSubmitConfirm ATTR=TXT:Click<SP>to<SP>order<SP>now
iMacro will use attributes like html type, form action and the text on the button to identify it against others. Once recorded you can start messing around with attributes if you have additional needs.
Solutions like CLICK or javascript have a tendency to almost never work (for me personally) and are used in more extreme cases where the buttons change names/ids/locations in an unpredictable way.
If you want to press enter to submit then you can do this this works in CHROME imacros for me ..
EVENT TYPE=KEYPRESS SELECTOR="#react-root>SECTION>MAIN>DIV>DIV>ARTICLE>DIV:nth-of-type(2)>SECTION:nth-of-type(3)>FORM>TEXTAREA" CHAR="\r"
I'd like to call imacros files from web pages to start automatically after button click or something. I have followed the imacros docs but i got confused.
Is there any method to do that?
thanks
I found a simple code did the job in new iMacros version.
imacros://run/?m=macrofile.iim
for example
Run macro
I'm executing the following macro from inside VB.net using the iMacros component for .NET
VERSION BUILD=10.4.28.1074
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6900914
SET !WAITPAGECOMPLETE YES
WAIT SECONDS=10
TAG POS=1 TYPE=H1 ATTR=* EXTRACT=TXT
This retrieves the name of the manuscript from IEEE Xplore. This works perfectly from inside the iMacros browser/editor. But, when executing the script from inside Vb.net, it gives me a "#EANF#" (Extraction Anchor Not Found).
I'm confounded.
I found the problem.
The difference in behavior was because the site (here, IEEE Xplore), does not allow browsing from old browsers. Now, the iMacro browser works under IE 7's name. All you need to do is to add your program to the "browser emulation list", thus morphing your iMacros component browser to "look" like a newer browser for those websites that need it.
You'll find all the details on how to do that here:
How do I turn off Compatibility View on the IE WebBrowserControl in a WinForms app?