ArNo
ArNo

Reputation: 2648

iMacros. How can I click a link in with tag <a>?

iMacros. How can I click a link in with tag ?

<a class="btn btn-primary" href="xxxxxx" style="margin:0;padding:14px 24px;font-family:Helvetica, Arial, sans-serif;color:#FFF;background-color:#13d883;font-size:14px;font-weight:600;margin-right:10px;text-align:center;text-decoration:none;text-transform:uppercase;" target="_blank">Activate your trial</a>

Upvotes: 1

Views: 4652

Answers (2)

Valera
Valera

Reputation: 91

imacros works well with XPATH, so you can use it to target specific element:

TAG XPATH="./a[contains(@href,'xxxxxx')]"

or

TAG XPATH="./a[contains(.,'Activate your trial')]"

CSS selectors work well too, the sample of syntax to use them is similar:

TAG SELECTOR="[selector_expression]"

more useful info on how to use TAG command here: http://wiki.imacros.net/TAG

Another option to implement mouse click itself is the "EVENT" command (for some specific sites this can be the only way to click elements):

EVENT TYPE=CLICK XPATH="./a[contains(.,'Activate your trial')]" BUTTON=0

more info here: http://wiki.imacros.net/EVENT

Upvotes: 2

Pinkie Pie
Pinkie Pie

Reputation: 728

Is your question just how to click that link?

You can use the iMacros recording functionality to generate simple code: http://wiki.imacros.net/First_Steps#Recording_Macros

Just click the link manually while recoding and you're good. You can then replay the recorded macro whenever you wish.


It will give you something like this

TAG POS=1 TYPE=A ATTR=TXT:Activate<SP>your<SP>trial

Upvotes: 0

Related Questions