Making Imacros click multiple possible names of a button

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
PuffyPrincess
Posts: 2
Joined: Sat Feb 24, 2018 4:19 pm

Making Imacros click multiple possible names of a button

Post by PuffyPrincess » Sat Feb 24, 2018 4:35 pm

I am using Imacros for Chrome (on windows) and am trying to make a simple series of clicks on a page the last of which results in it going to another nearly identical page where it does the same thing and so it moves from page to page ect... The page is private so I can't give a link. Here's the script:

VERSION BUILD=1001 RECORDER=CR
TAG POS=1 TYPE=A ATTR=ID:boutonPanser
TAG POS=1 TYPE=A ATTR=ID:boutonMissionForet
TAG POS=1 TYPE=A ATTR=ID:boutonCoucher
TAG POS=1 TYPE=A ATTR=ID:boutonNourrir
TAG POS=1 TYPE=SPAN ATTR=TXT:12
TAG POS=2 TYPE=SPAN ATTR=TXT:2
TAG POS=4 TYPE=SPAN ATTR=TXT:Feed
TAG POS=1 TYPE=A ATTR=ID:nav-previous

This works but only when the button on line 3 is called boutonMissionForet. The problem is the name of the button changes randomly between 3 possible names. What I am trying to do is allow for the changing of the name of the button on line 3 and have it set to click whichever of the three names/versions of the button is randomly generated on that page. I tried adding &&ATTR=ID:boutonMissionMontagne on the end but I think that the && thing is to identify the elements one button might have and not allow for multiple button names being acceptable... (After doing this it wouldn't run even when the button was MissionForet.) Would appreciate some help because I've tried googling and looking at tutorials and I just can't find how to do this. Thanks and let me know if you would need more information :)
chivracq
Posts: 9309
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Making Imacros click multiple possible names of a button

Post by chivracq » Sat Feb 24, 2018 5:51 pm

PuffyPrincess wrote:I am using Imacros for Chrome (on windows) and am trying to make a simple series of clicks on a page the last of which results in it going to another nearly identical page where it does the same thing and so it moves from page to page ect... The page is private so I can't give a link. Here's the script:

Code: Select all

VERSION BUILD=1001 RECORDER=CR
TAG POS=1 TYPE=A ATTR=ID:boutonPanser
TAG POS=1 TYPE=A ATTR=ID:boutonMissionForet
TAG POS=1 TYPE=A ATTR=ID:boutonCoucher
TAG POS=1 TYPE=A ATTR=ID:boutonNourrir
TAG POS=1 TYPE=SPAN ATTR=TXT:12
TAG POS=2 TYPE=SPAN ATTR=TXT:2
TAG POS=4 TYPE=SPAN ATTR=TXT:Feed
TAG POS=1 TYPE=A ATTR=ID:nav-previous
This works but only when the button on line 3 is called boutonMissionForet. The problem is the name of the button changes randomly between 3 possible names. What I am trying to do is allow for the changing of the name of the button on line 3 and have it set to click whichever of the three names/versions of the button is randomly generated on that page. I tried adding &&ATTR=ID:boutonMissionMontagne on the end but I think that the && thing is to identify the elements one button might have and not allow for multiple button names being acceptable... (After doing this it wouldn't run even when the button was MissionForet.) Would appreciate some help because I've tried googling and looking at tutorials and I just can't find how to do this. Thanks and let me know if you would need more information :)
FCIM...! :mrgreen: (Read my Sig...)
=> iMacros for CR v10.0.1, Free or PE...?, CR65...?, OS=Win...?

Hum, I normally don't help for Games, even if I play several (similar) Games myself as well, ah-ah...!, a bit surprised btw to see that there are obviously so many Online Horse Breeding Games in French, ah-ah...!

But OK, your "Case" sounds quite simple, simply use '!ERRORIGNORE' I would think, and include the 3 different 'TAG' Statements corresponding to the 3 "Missions"..., your Script will "try" them all 3, and one of the 3 will do the job...!
And shorten as well maybe '!TIMEOUT_STEP' to 1 or 0 sec if you don't want your Script to wait 2x 6 sec for the 2 Statements that won't do anything...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
chivracq
Posts: 9309
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Making Imacros click multiple possible names of a button

Post by chivracq » Sat Feb 24, 2018 6:08 pm

Hum, and another Solution, if your 3 'Mission' Buttons all contain the same part "boutonMission...xxx" in their ID (you only mentioned 2), then it's possible to replace the changing part with a Wildcard, and you then only need 1 'TAG' Statement instead of 3 like in the first "Solution":

Code: Select all

TAG POS=1 TYPE=A ATTR=ID:boutonMission*
Your Script will then click the first 'boutonMission...xxx' it will find on the Page... 8)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
PuffyPrincess
Posts: 2
Joined: Sat Feb 24, 2018 4:19 pm

Re: Making Imacros click multiple possible names of a button

Post by PuffyPrincess » Sun Feb 25, 2018 10:00 pm

Thank you so much using * worked perfectly :D
(And for the record it's the free iMacros for Chrome 10.0.1, Chrome Version 64 and windows :roll: .)
chivracq
Posts: 9309
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Making Imacros click multiple possible names of a button

Post by chivracq » Sun Feb 25, 2018 10:38 pm

PuffyPrincess wrote:Thank you so much using * worked perfectly :D
(And for the record it's the free iMacros for Chrome 10.0.1, Chrome Version 64 and windows :roll: .)
OK, good to hear, and Thanks for the Feedback... :D

And good that you mentioned your FCI, even if it didn't really play a big "Role" for this Thread as you only use very "Standard" iMacros Commands supported in all Browsers and all Versions, but like explained in my Sig, I usually don't even read the Post and certainly don't answer if that Info is not mentioned (clearly) when opening a new Thread... :wink:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply