Using imacro to select span class and then clicking on button class - imacros

I want to click on a button class named wp06b
Normally I would do something like
TAG POS=1 TYPE=BUTTON ATTR=CLASS:wpO6b
However it does not work in my case probably because there is many wp06b class [see printscreen below].
But there is only 1 span class named fr66p and inside it there there is only 1 button class wp06b.
So my question is how to use imacro to go inside fr66p and then click on button class wp06b ?
I can select the class fr66n but then I do not know how to use imacro to select button class wp06b...
TAG POS=1 TYPE=SPAN ATTR=CLASS:fr66n
wait seconds=2

Hum..., I normally don't answer when FCI is not mentioned... You may want to check my Profile for how to ask Qt's about iMacros "correctly"...
But yep, typical Application for "Double Relative Positioning"... (100+ Examples on the iMacros Forum):
TAG POS=1 TYPE=SPAN ATTR=CLASS:fr66n
TAG POS=R1 TYPE=* ATTR=*
TAG POS=R-1 TYPE=BUTTON ATTR=CLASS:wpO6b
If the 'SPAN' Element is clickable, you'll need to add a "fake" 'EXTRACT', same for the 'R1' which will be the "_15y01" 'SPAN'...
[R-1 + R1] would also probably work, but not on "TYPE=*" which would catch the 'SECTION' Container, you would need to specify "TYPE=SPAN", I think..., but [R1 + R-1] seems to be easier and "safer" in this Case... URL not posted, I cannot test...
And if any of the 2 'DIV' + 'SVG' Elements inside the 'SPAN' and also inside the 'BUTTON' are unique or easily taggable, then you could use either one as 'Anchor' and you would only need "Single" 'Relative Positioning' with 'R-1'.

Related

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}}

Clicking almost 2 identical urls with imacro

I am working on a imacro script and i am just stuck with it and can't figure out what i am doing wrong.
It is a macro thát visits a certain forum part and it needs to click 2 links.
They are almost identical except for 1 part.
It is used to download attachments.
Code i got at the moment:
TAG POS=1 TYPE=A ATTR=ID:aid* EXTRACT=href
tab open
tab t=2
url goto={{!EXTRACT}}
TAB CLOSE
TAG POS=2 TYPE=A ATTR=ID:aid* EXTRACT=href
tab open
tab t=2
url goto={{!EXTRACT}}
I also tried it like this:
TAG POS=1 TYPE=A ATTR=HREF:*linkhere*/forum.php?mod=attachment&aid=* EXTRACT=href
tab open
tab t=2
url goto={{!EXTRACT}}
SET !EXTRACT NULL
TAB CLOSE
TAG POS=2 TYPE=A ATTR=TXT:*.pdf EXTRACT=HREF
SET link EVAL("'{{!EXTRACT}}'.match(/(http.*)\./)[1];")
URL GOTO={{link}}
but still no luck.
As you see 1 file is a image, but the 2nd file can be a pdf or zip/rar file.
Most of them are pdf tough.
Hopefully can point me in the right direction with this as i got no clue anymore...
Why don't you simply save the files directly?
Do you need to open them in a different tab?
TAG POS=1 TYPE=IMG ATTR=HREF:http://*.jpg CONTENT=EVENT:SAVEITEM
TAG XPATH="/html/body/div[1]/form/div[3]/div/h2/span[2]/a[1]" CONTENT=EVENT:SAVETARGETAS
or something like that depending on what you have there.
I prefer to refer items by XPATH, but that's just me

Select Month/Gender in Gmail account creation with imacros

Trying to automate gmail account creation using iMacros. Facing problem in selecting Gender and Month.
Tried StackOverFlowSolution but it is not working for me. It reports that the command not found. Is it some version mismatch issue or am I missing something?
Can anybody help me in resolving this?
Pasted below the recording along with this fix for reference.
VERSION BUILD=8340723 RECORDER=CR
URL GOTO=https://accounts.google.com/SignUp?dsh=447577167596141020&continue=https%3A%2F%2Faccounts.google.com%2FManageAccount#FirstName=&LastName=
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:createaccount ATTR=ID:PasswdAgain CONTENT=asdf123
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:createaccount ATTR=ID:BirthDay CONTENT=15
TAG POS=1 TYPE=SPAN ATTR=ID:birthyear-placeholder
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:createaccount ATTR=ID:BirthYear CONTENT=1989
TAG POS=1 TYPE=INPUT:TEL FORM=ID:createaccount ATTR=ID:RecoveryPhoneNumber CONTENT=+919791151088
SET monthNum 7
SET monthSlc EVAL("var s = '{{monthNum}}'; switch ('{{monthNum}}') {case '10': s = 'a'; break; case '11': s = 'b'; break; case '12': s = 'c'; break;} '#\\\\:' + s + '>DIV';")
SET listSlc "#BirthMonth>DIV>DIV:nth-of-type(2)"
EVENT TYPE=MOUSEDOWN SELECTOR={{listSlc}} BUTTON=0
EVENT TYPE=MOUSEUP SELECTOR={{listSlc}} BUTTON=0
EVENT TYPE=MOUSEDOWN SELECTOR={{monthSlc}} BUTTON=0
EVENT TYPE=MOUSEUP SELECTOR={{monthSlc}} BUTTON=0
You could definitely do this with imacros. Just a small workaround for this.
Below is the code
TAG POS=1 TYPE=INPUT:HIDDEN ATTR=ID:HiddenBirthMonth CONTENT=05
TAG POS=1 TYPE=INPUT:HIDDEN ATTR=ID:HiddenGender CONTENT=MALE
You can change the above Hidden Input Field's value, and the Month and Gender will get updated (though it might not be visible for the user)
Cheers!
I just checked and actually they seem use div and not a select to do it.
The change is probably triggered by javascript. But I thing it would be a waste to time trying to go through their's.
I just saw that the month change the attribute aria-posinset="6". Here it is for June. I don't think that you can change one with iMacros.
For the current form, dated 11/1/2018. I did the following and it worked to populate gender and month:
TAG POS=1 TYPE=SELECT ATTR=ID:gender CONTENT=3
TAG POS=1 TYPE=SELECT ATTR=ID:month CONTENT=3
The #3 for CONTENT is just the option number to select. You can change that accordingly.

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.