How can i pass more than one value for single ID in ATTR field?

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
EW123
Posts: 14
Joined: Thu Jul 04, 2019 4:47 am

How can i pass more than one value for single ID in ATTR field?

Post by EW123 » Tue Jul 16, 2019 9:58 am

Code: Select all

VERSION BUILD=1005 RECORDER=CR
free extensiton on Chrome 75, win 10 
I want to do selection based on the "OR" in ATTR value.
So, can anyone help me with syntax to do this?

for Ex.

Code: Select all

TAG POS=1 TYPE=A ATTR=id:("value1"||"value2"||"value3")
so the code will run when any of the value1, value 2 or value 3 get passed.

ps. btw I have tried to find on google and this forum but couldn't found one, so asking here.
Last edited by EW123 on Thu Jul 18, 2019 5:16 am, edited 1 time in total.
EW123
Posts: 14
Joined: Thu Jul 04, 2019 4:47 am

Re: How to pass more than one value for single ID in ATTR field

Post by EW123 » Thu Jul 18, 2019 4:38 am

EW123 wrote:
Tue Jul 16, 2019 9:58 am

Code: Select all

VERSION BUILD=1005 RECORDER=CR
free extensiton on Chrome 75, win 10 
I want to do selection based on the "OR" in ATTR value.
So, can anyone help me with syntax to do this?

for Ex.

Code: Select all

TAG POS=1 TYPE=A ATTR=id:("value1"||"value2"||"value3")
so the code will run when any of the value1, value 2 or value 3 get passed.

ps. btw I have tried to find on google and this forum but couldn't found one, so asking here.
Anyone can help ?
chivracq
Posts: 8761
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to pass more than one value for single ID in ATTR field

Post by chivracq » Thu Jul 18, 2019 5:06 am

EW123 wrote:
Tue Jul 16, 2019 9:58 am

Code: Select all

VERSION BUILD=1005 RECORDER=CR
free extensiton on Chrome 75, win 10 
I want to do selection based on the "OR" in ATTR value.
So, can anyone help me with syntax to do this?

for Ex.

Code: Select all

TAG POS=1 TYPE=A ATTR=id:("value1"||"value2"||"value3")
so the code will run when any of the value1, value 2 or value 3 get passed.

ps. btw I have tried to find on google and this forum but couldn't found one, so asking here.
EW123 wrote:
Thu Jul 18, 2019 4:38 am
Anyone can help ?

Yeah..., maybe..., there are several Methods, but I had not reacted as you had not mentioned your FCI in your parallel Thread on SOF... :roll:

And for both Forums, you also need to add a '?' at the end of your Thread Title(s), you are not sharing a 'How-To'... :roll:

Perfectly fine to open parallel Threads on different Forums but you need to provide the same "Quality" on both or I don't react on any... :|
- (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...
EW123
Posts: 14
Joined: Thu Jul 04, 2019 4:47 am

Re: How to pass more than one value for single ID in ATTR field

Post by EW123 » Thu Jul 18, 2019 5:15 am

chivracq wrote:
Thu Jul 18, 2019 5:06 am
Yeah..., maybe..., there are several Methods, but I had not reacted as you had not mentioned your FCI in your parallel Thread on SOF... :roll:

And for both Forums, you also need to add a '?' at the end of your Thread Title(s), you are not sharing a 'How-To'... :roll:

Perfectly fine to open parallel Threads on different Forums but you need to provide the same "Quality" on both or I don't react on any... :|
Okay, i have deleted the SOF Thread and added the "?" to this thread :)
chivracq
Posts: 8761
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How can i pass more than one value for single ID in ATTR field?

Post by chivracq » Thu Jul 18, 2019 3:36 pm

EW123 wrote:
Thu Jul 18, 2019 5:15 am
chivracq wrote:
Thu Jul 18, 2019 5:06 am
Yeah..., maybe..., there are several Methods, but I had not reacted as you had not mentioned your FCI in your parallel Thread on SOF... :roll:

And for both Forums, you also need to add a '?' at the end of your Thread Title(s), you are not sharing a 'How-To'... :roll:

Perfectly fine to open parallel Threads on different Forums but you need to provide the same "Quality" on both or I don't react on any... :|
Okay, i have deleted the SOF Thread and added the "?" to this thread :)
Oh...!?, deleting your Thread on a Forum is not "really" the correct way to use that Forum, that's usually a "Show-Killer" for me when Users do it on "our" Forum..., :shock: even if that cannot "really" happen when I start answering a Thread as I systematically quote for this very Reason... :twisted:
There was nothing "wrong" with your Thread on SOF, well except the 2 mini-"Points" I had mentioned... But OK, never mind, I don't "really" like that Forum and I rarely answer Qt's/Threads there, exactly for that Reason...

Hum, and you didn't "notice" that your new Title was not taken into account in your last Post as you quoted a previous Post of mine that still had the original Title... :wink:

>>>

But OK, "several Methods" I mentioned, already have a look at the following (similar/related) Thread where I mentioned 4 of those already, which can be combined together, depending a bit on your specific Site and those "valueX" Values...:
- Re: IMacros TAG Case-Insensitive
That Post of mine is a bit "far" already in that Thread as it took nearly one Page before the User finally mentioned their FCI, but read also the OP to understand the Scenario...
From, the 4 (possible) Solutions I mentioned in my Post, the "preferred Order" in your Case would be 4-1-3-2, I would think...
And all 4 are "Shortcuts" and "Workarounds"...

- A 5th Method would be to simply triple the 'TAG' Statement on all 3 Values, with '!ERRORIGNORE' and a short '!TIMEOUT_STEP', in your preferred Order, and your Script will follow the first Link it will find... It's still a Shortcut/Workaround...

Then Methods 6 + 7 are "exact" Answers to your Qt in your OP...:
- Method 6: Like Method_5 but you first fire an 'EXTRACT=TXT' on the 3 Links, and using 'EVAL()' by checking on "#EANF#", you recompute the "correct" 'ID' to use for a 4th 'TAG' Statement that will be the "real" 'TAG' Statement.
A little "complicated" by the fact that you are using v10.0.5 for CR 'Free' for which you can only use 3 Vars, but there are more than 10 ways to bypass that Limitation from the 'Free' Versions... (Several Threads about that on the Forum...)

- Method 7: I think that's stg the 'TAG XPATH' can probably do, in just one Statement as there is an 'or' Operator in the 'XPATH' Implementation... And I guess iMacros probably supports it...

But I never use and have never used 'XPATH'/'REGEX' as I always prefer to use one (or more) of the "Shortcuts" I've mentioned in Methods [1-5], so I have never "plaid" with it, and you didn't provide any URL Info about your Site, so I can't even do any "Experimenting" even if I wanted...
And that's where your Thread on SOF could maybe have come in "handy" for that part, there is probably more "Expertise" about 'XPATH' and 'REGEX' on SOF than on our Forum, if you choose to go for this Method... 8)

Well..., good "luck" and post "later" for which (Combination of) Method(s) you went and share your Final Script..., or if you get "stuck" in the "Process"... :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...
EW123
Posts: 14
Joined: Thu Jul 04, 2019 4:47 am

Re: How can i pass more than one value for single ID in ATTR field?

Post by EW123 » Thu Jul 18, 2019 4:27 pm

chivracq wrote:
Thu Jul 18, 2019 3:36 pm

But OK, "several Methods" I mentioned, already have a look at the following (similar/related) Thread where I mentioned 4 of those already, which can be combined together, depending a bit on your specific Site and those "valueX" Values...:
- Re: IMacros TAG Case-Insensitive
That Post of mine is a bit "far" already in that Thread as it took nearly one Page before the User finally mentioned their FCI, but read also the OP to understand the Scenario...
From, the 4 (possible) Solutions I mentioned in my Post, the "preferred Order" in your Case would be 4-1-3-2, I would think...
And all 4 are "Shortcuts" and "Workarounds"...

- A 5th Method would be to simply triple the 'TAG' Statement on all 3 Values, with '!ERRORIGNORE' and a short '!TIMEOUT_STEP', in your preferred Order, and your Script will follow the first Link it will find... It's still a Shortcut/Workaround...

Then Methods 6 + 7 are "exact" Answers to your Qt in your OP...:
- Method 6: Like Method_5 but you first fire an 'EXTRACT=TXT' on the 3 Links, and using 'EVAL()' by checking on "#EANF#", you recompute the "correct" 'ID' to use for a 4th 'TAG' Statement that will be the "real" 'TAG' Statement.
A little "complicated" by the fact that you are using v10.0.5 for CR 'Free' for which you can only use 3 Vars, but there are more than 10 ways to bypass that Limitation from the 'Free' Versions... (Several Threads about that on the Forum...)

- Method 7: I think that's stg the 'TAG XPATH' can probably do, in just one Statement as there is an 'or' Operator in the 'XPATH' Implementation... And I guess iMacros probably supports it...

But I never use and have never used 'XPATH'/'REGEX' as I always prefer to use one (or more) of the "Shortcuts" I've mentioned in Methods [1-5], so I have never "plaid" with it, and you didn't provide any URL Info about your Site, so I can't even do any "Experimenting" even if I wanted...
And that's where your Thread on SOF could maybe have come in "handy" for that part, there is probably more "Expertise" about 'XPATH' and 'REGEX' on SOF than on our Forum, if you choose to go for this Method... 8)

Well..., good "luck" and post "later" for which (Combination of) Method(s) you went and share your Final Script..., or if you get "stuck" in the "Process"... :wink:
Hi, thanks for the reply

so, there is no direct solution to it...

actually, the value1,value2 etc... or any comes dynamically depending on users location & value is within the same TAG(dynamic) and changes with just language being changed...
So, it's become lit-bit hard to separate both things unless using some if-else with js.

so your first 4 solutions will surely not work for me... 5th might work but i don't wont to use error ignore method... 6th looks promising, will check it out...
and for 7th, "or" operator for Xpath and regex's didn't worked.
chivracq
Posts: 8761
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How can i pass more than one value for single ID in ATTR field?

Post by chivracq » Thu Jul 18, 2019 5:58 pm

EW123 wrote:
Thu Jul 18, 2019 4:27 pm
Hi, thanks for the reply

so, there is no direct solution to it...

actually, the value1,value2 etc... or any comes dynamically depending on users location & value is within the same TAG(dynamic) and changes with just language being changed...
So, it's become lit-bit hard to separate both things unless using some if-else with js.

so your first 4 solutions will surely not work for me... 5th might work but i don't wont to use error ignore method... 6th looks promising, will check it out...
and for 7th, "or" operator for Xpath and regex's didn't worked.

"so, there is no direct solution to it..." => well, beh..., yes there is...!, Methods [6-7] I mentioned, and especially Nb_7, I'm not really convinced by your "and for 7th, "or" operator for Xpath and regex's didn't worked." as you didn't post anything about what you tried and how you tried to use 'XPATH' exactly...
Even if hum..., that wouldn't be my "first Choice", as like I mentioned, I don't "like" 'XPATH' & 'REGEX', and in 10 years I've been using iMacros, I've always found a way to "avoid" those 2, ah-ah...! :twisted: (Just like I never use 'match()' nor 'SEARCH' for example...) So I'm not "really" convinced either by your "so your first 4 solutions will surely not work for me...", (well it's "3" actually, you can probably drop the one with the 'EVENT' Mode...), there is always "a Way" to get it to work, unless maybe the Content of the whole Page is VERY Dynamic, => for Content + LARGE Quantity (of similar Elements) + Layout..., but this only happens on very badly designed Sites, or on purpose by the Site Owner, but I would need to have a look at the Page... :roll:

And hum, you actually gave me an "Idea" about maybe an 8th Method, stg I've never tried (yet), funny to notice how "conditioned" we are to think in a "formatted Way", I'll need to give it a Try "one day"... Could be useful if that "works"... 8) [=> "&&" for me to "remember"... :wink: ]

And if the final/real "Purpose" of your Thread is "only" to deal with Dynamic ID's, there are also other Techniques to deal with Dynamic ID's, with several Threads about that on the Forum also... :idea:
The Scenario you described in your OP is pretty generic though precise at the same time as you already have an Implementation in mind, and in my "Experience", that kind of Threads are in maybe 8 out of 10 times, the "Result" of a very cumbersome Idea for an Implementation by the User, and I would probably find 3 much easier and more straightforward Solutions if I had "the full Picture" of the Scenario, the Requirements and the Conditions... :roll:
- (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