Auto Click a button until a specific text appear in page using iMacros - imacros

I'm trying to make an auto-click to a button on a website and do nothing when a specific text appears on the page
Using iMacros, how can I use if a specific text element had the value I wanted so it won't skip?
HTML:
<span class="tr-country" data-tr="IQ">Iraq</span>
<i class="flag message-flag flags-IQ"></i>
iMacros Recorder:
VERSION BUILD=1011 RECORDER=CR
URL GOTO=https://ometv.chat/
FRAME F=1
TAG POS=2 TYPE=DIV ATTR=TXT:next
TAG POS=2 TYPE=SPAN ATTR=TXT:South<SP>Africa (Some Random Country)
TAG POS=1 TYPE=I ATTR=CLASS:flag<SP>message-flag<SP>flags-ZA
What I want is to check if the class "tr-country" has the data-tr of "IQ" then we don't click/tag "next" button
How can I do that condition in iMacros?
Thanks in advance..
FCI:
iMacros for Chrome 10.1.1 Free
Windows 10 English
Version 96.0.4664.93 (Official Build) (64-bit)

Related

Extract dynamic content with iMacros

I'm entirely new to iMacros, and I'm trying to get iMacros to extract the email address that appears when you click "reply" on ads like these. (Link is "dead"...)
The only thing I have is:
VERSION BUILD=10021450
URL GOTO=https://losangeles.craigslist.org/sfv/res/d/need-extra-money/7027377618.html
TAG POS=1 TYPE=BUTTON ATTR=TXT:reply
I have tried simply using wildcards, which doesn't work.
I found the answer somehow:
TAG POS=1 TYPE=INPUT ATTR=CLASS:anonemail EXTRACT=TXT

iMacro text field Inputting issue

hopefully you can help me. This is my attempt at using a macro to add text into a text field on a website.​
This is my current iMacro code, which opens the text box (by clicking a couple of buttons) however doesn't activate the text box nor add any text into it:
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
URL GOTO=https://datatron.l2inc.com/#resources?selected=brandTab5229&brands=5229
TAG POS=1 TYPE=BUTTON ATTR=TXT:Create<SP>New<SP>Resources<SP>for<SP>Brand
TAG POS=1 TYPE=BUTTON ATTR=ID:add-urls
PROMPT "Please enter something:" !VAR1
TAG POS=1 TYPE=TEXTAREA ATTR=CLASS:form-control CONTENT={{!VAR1}}
The last lines are my attempt adding my own text (VAR1) into the textbox. The relevant html code (created by javascript) simply reads as this:
​<textarea class="form-control urls-textarea" rows="10" placeholder="irrelevant placeholder text"></textarea>
Do you know where I am going wrong??
Best regards
Roman
Try to record your manual typing wlth 'Experimental event recording mode'.
Taking into account the html code you provided, the event command may look like:
EVENTS TYPE=KEYPRESS SELECTOR="textarea[class='form-control urls-textarea']" CHARS={{!VAR1}}

how to write .iim file for imacros

VERSION BUILD=6060703 RECORDER=CR
URL GOTO=URL
TAG POS=1 TYPE=INPUT:BUTTON ATTR=*
WAIT SECONDS=6
This is the code I'm using for .iim file to click on a button on a website. But I couldn't understand what this code is and what are those tag pos and button attr. When I run this code there's an error like this.
RuntimeError: element INPUT specified by * was not found, line: 3
What is this error and how to tackle it. Please help.
TAG POS=1 TYPE=INPUT:BUTTON ATTR=*
This is a button that submits something. Find that button on web page. Right click on it and select "Inspect Element". Then you will see HTML code of that button.
If it has property name="somename" or id="someid" then you will put
TAG POS=1 TYPE=INPUT:BUTTON ATTR=NAME:somename
TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:someid

iMacro dynamic attribute data extract

I have been trying to resolve this issue through different angles but not having any luck. Even tried using PHP to generate iMacro code to do this but really no luck.
Basically I am trying to use iMacro to pull some form data but the problem is on every page of the form I have 100 links to click but the issue is that I don't know how to tell iMacro to keep clicking the links in the table without specifying each link's name in the attribute:
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>China
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>Mexico
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>Japan
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>Brazil
See how the ATTR=TXT field indicates the text of the element in the table? This means to get iMacro to click all the links I have to specify every element's text....This is a pain..Is there a way I can get iMacro to click on the links without specifying the text?
UPDATE: Here is the updated code that highlights but won't click the first link.
FRAME NAME=TargetContent
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=TXT:*
'New tab opened
TAB T=2
TAG POS={{!LOOP}} TYPE=DIV ATTR=ID:win2divUW_CO_JOBDTL_VW_UW_CO_JOB_DESCR EXTRACT=TXT
TAB CLOSE
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Documents\iMacro FILE=TestRun.csv
Here is what the HTML of the first link in table looks like, it is all generated by the server:
<a name="UW_CO_sd_HL$0" id="UW_CO_sd_HL$0" tabindex="72" href="javascript:hAction_win0(document.win0,'UW_CO_sd_HL$0', 0, 0, 'Trip To Tokyo', false, true);" class="PSHYPERLINK">Tokyo</a>
The second HTML link in table looks like:
<a name="UW_CO_sd_HL$1" id="UW_CO_sd_HL$0" tabindex="78" href="javascript:hAction_win0(document.win0,'UW_CO_sd_HL$1', 0, 0, 'Tonka Side', false, true);" class="PSHYPERLINK">Tonka</a>
UPDATE 2:
Here is the iMacro code after I do experimental recording and then x/y co-ordinate click. The code is from clicking the first couple of elements.
CLICK X=131 Y=473
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=153 Y=500
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=194 Y=541
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=152 Y=572
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=149 Y=608
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=169 Y=629
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=173 Y=666
TAB T=2
TAB CLOSE
TAB T=1
This code can be transformed to work better.
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>*
For example if the links HTML looks like this
Trip to Somewhere
Then you can use these combinations of iMacros code to click the links.
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=CLASS:link&&TXT:*
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=ID:linkid&&TXT:*
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=HREF:www.somelink.com/soomething_different_here/*&&TXT:*
Each of these combinations can work.

Imacros help, script was working but not now

This line was working before but now it doesn't extract the text, I guess this is happening because it is clicking inside the box. This only happen when I use Firefox, using Internet Explorer is ok.
VERSION BUILD=8021970
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.fakemailgenerator.com/
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:emailForm ATTR=ID:fName&&VALUE:* EXTRACT=TXT
it looks like the value you need is disappear when imacros tries to scrape it, but you can use this code to get email:
URL GOTO=http://www.fakemailgenerator.com/
TAG POS=1 TYPE=span attr=id:cxtEmail EXTRACT=TXT
or you can scrape htm of your tag and parse it to get value attribute