Search code examples
imacros

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


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].

enter image description here

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

Solution

  • 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'.