[SOLVED]: Variables in TAG command are not resolved

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
RealCasi
Posts: 19
Joined: Tue Jul 30, 2019 8:03 pm

[SOLVED]: Variables in TAG command are not resolved

Post by RealCasi » Wed Sep 08, 2021 11:45 am

Hello everybody,

we need to mark certain values in a checkbox list.

If I record a macro it is giving me lines like

Code: Select all

TAG POS=1 TYPE=A ATTR=HREF:https://www.biconeo-aquascaping.de/mod/shop_admin/?sh_fn=article_edit&sub_fn=set_art_cat&cat_id=36&art_id=2323
TAG POS=1 TYPE=A ATTR=HREF:https://www.biconeo-aquascaping.de/mod/shop_admin/?sh_fn=article_edit&sub_fn=set_art_cat&cat_id=39&art_id=2323 
-> This example adds the categories 36 and 39 to the article 2323

We have the article Ids and the category Ids available, so I put them in a CSV file. Connecting to the CSV works, I get different values from the CSV in my script nicely.

The problem comes with line:

Code: Select all

TAG POS=1 TYPE=A ATTR=HREF:https://www.biconeo-aquascaping.de/mod/shop_admin/?sh_fn=article_edit&sub_fn=set_art_cat&cat_id={{!COL4}}&art_id={!COL5}}
This leads to the error "Element not found" where you can see that iMacro doesn't resolve the CSV columns to the desired values.

I tried

Code: Select all

SET myString https://www.biconeo-aquascaping.de/mod/shop_admin/?sh_fn=article_edit&sub_fn=set_art_cat&cat_id={{!COL4}}&art_id={!COL5}}
TAG POS=1 TYPE=A ATTR=HREF:{{myString}} 
This comes to "Error: "-1300: ElementNotFound" at line 28 TAG POS=1 TYPE=A ATTR=HREF:{{myString}} Could not find element", in other words, again the variable is not resolved.

Can anybody help?

All the best
Casi

Setup Information:
iMacros 2021.0, Personal Edition
iMacros Browser 2021.0
Windows 10 German
...and I used the search function. If the solution is already described, just let me know and send a link please :roll:
Last edited by chivracq on Wed Sep 08, 2021 2:04 pm, edited 1 time in total.
Reason: '[SOLVED]' Tag added to Thread Title...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Variables in TAG command are not resolved

Post by chivracq » Wed Sep 08, 2021 12:20 pm

RealCasi wrote:
Wed Sep 08, 2021 11:45 am
Hello everybody,

we need to mark certain values in a checkbox list.

If I record a macro it is giving me lines like

Code: Select all

TAG POS=1 TYPE=A ATTR=HREF:https://www.biconeo-aquascaping.de/mod/shop_admin/?sh_fn=article_edit&sub_fn=set_art_cat&cat_id=36&art_id=2323
TAG POS=1 TYPE=A ATTR=HREF:https://www.biconeo-aquascaping.de/mod/shop_admin/?sh_fn=article_edit&sub_fn=set_art_cat&cat_id=39&art_id=2323 
-> This example adds the categories 36 and 39 to the article 2323

We have the article Ids and the category Ids available, so I put them in a CSV file. Connecting to the CSV works, I get different values from the CSV in my script nicely.

The problem comes with line:

Code: Select all

TAG POS=1 TYPE=A ATTR=HREF:https://www.biconeo-aquascaping.de/mod/shop_admin/?sh_fn=article_edit&sub_fn=set_art_cat&cat_id={{!COL4}}&art_id={!COL5}}
This leads to the error "Element not found" where you can see that iMacro doesn't resolve the CSV columns to the desired values.

I tried

Code: Select all

SET myString https://www.biconeo-aquascaping.de/mod/shop_admin/?sh_fn=article_edit&sub_fn=set_art_cat&cat_id={{!COL4}}&art_id={!COL5}}
TAG POS=1 TYPE=A ATTR=HREF:{{myString}} 
This comes to "Error: "-1300: ElementNotFound" at line 28 TAG POS=1 TYPE=A ATTR=HREF:{{myString}} Could not find element", in other words, again the variable is not resolved.

Can anybody help?

All the best
Casi

Setup Information:

Code: Select all

iMacros 2021.0, Personal Edition
iMacros Browser 2021.0 
Windows 10 German
...and I used the search function. If the solution is already described, just let me know and send a link please :roll:

Hum, your FCI is a bit unclear, which will be "important" Info as your Issue sounds like it could come from a Bug, => so, if you could clarify...?:
Setup Information:

Code: Select all

iMacros 2021.0, Personal Edition
iMacros Browser 2021.0 
Windows 10 German
... Because there is no 'PE' Version for iMB (v2021.x or 12.x etc...), only "Full" (=> 'Pro' or 'Enterprise' which are actually the same, the 'Ent' Version also contains the 'SI' ('Scripting Interface'), but iMB is the same) and 'Trial'.

If you are using a 'PE' Version, then the Browser won't be iMB v2021.0, but CR92/93 + iMacros v10.1.1 for CR, // or FF91 + iMacros v10.1.0 for FF.

>>>

Hum, Behaviour you describe sounds like a Bug, and if related to iMB v2021, I cannot do any Testing myself, I had installed the 'Trial' Version when it got released a few months ago, but that 'Trial' has already long expired, and v10.x for FF/CR also require the 'FIO' Module for the '!COLn' Command, so I cannot test either... (as I only have the 'Free' Versions).

But hum, before calling "it" a Bug, some more Checking you need to do, Pb could still come from your '.CSV'...

Oh..., but no-no, wait, dead simple, ah-ah...!, you simply have a Typo in: :P

Code: Select all

&cat_id={{!COL4}}&art_id={!COL5}}
=> Missing Accolade for '!COL5', oops...!! :wink:

=> Should be:

Code: Select all

&cat_id={{!COL4}}&art_id={{!COL5}}
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
RealCasi
Posts: 19
Joined: Tue Jul 30, 2019 8:03 pm

Re: Variables in TAG command are not resolved

Post by RealCasi » Wed Sep 08, 2021 1:12 pm

Thank you chivracq!

The Version is Pro, I bought a PE in 2019 and didn't realize that the version names have changed with some update. Anyway, it's iMacros Browser 2021.0 for sure.

It's even different.... the problem is in the error message!

1. Sure there was a typo in the quoted code. But: The typo was not in the code I tried with.
2. I kept testing with a simple prompt to learn about variable resolving and came to the following result:

Code: Select all

SET myString2 HREF:https://www.biconeo-aquascaping.de/mod/shop_admin/?sh_fn=article_edit&sub_fn=set_art_cat&cat_id=36&art_id={{!COL5}}
PROMPT {{myString2}}
nicely gave me the expected URL in the prompt window - the variable WAS resolved.
3. BUT: For a reason that has nothing to do with iMacro I couldn't reach the URL in the given session context. That's a detail of our online shop I don't need to explain here.
4. Ok, I got the quoted error message and this message said again ..."art_id={{!COL5}}" which made me believe the variable was not resolved. In fact iMacro tried to open the correct URL!

I fixed the shop-related issue and now it works. Topic can be closed.
Feel free to delete it - since my assumption was wrong - or change the subject to "misleading error message when URL with variable in can't be reached"

Thank you again
Casi
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: [SOLVED]: Variables in TAG command are not resolved

Post by chivracq » Wed Sep 08, 2021 2:02 pm

RealCasi wrote:
Wed Sep 08, 2021 1:12 pm
Thank you chivracq!

The Version is Pro, I bought a PE in 2019 and didn't realize that the version names have changed with some update. Anyway, it's iMacros Browser 2021.0 for sure.

"... the version names have changed with some update."
=> Hum..., nope, not really... Well, iMB went from "v12.x" (based on 'IE') to "v2021.x" (based on 'Chromium') but the License Names remained the same, and a 'PE' License in 2019 "only" gave "Access" to the Browser Add-ons for IE (=> v12.x 'PE' for IE), FF (=> v10.x 'PE' for FF) and CR (=> v10.x 'PE' for CR), but not to iMB (=> v12.5 or v12.6 at that time)...

One "good Novelty" with iMB v2021.0, is that the ('Trial') Installer for iMB v2021.x ('Trial') also includes a 'Trial' Version for v10.x for FF + CR, which is a very Good Thing in my Opinion... :D
(There was/were no 'Trial' Version(s) previously for the 'PE' Versions for the 3 Browser Add-ons...)

"Anyway, it's iMacros Browser 2021.0 for sure."
=> OK, and yep indeed, I should have been able to "confirm" with "Error: -1300" which is indeed specific to iMB only... :P

>>>
RealCasi wrote:
Wed Sep 08, 2021 1:12 pm
It's even different.... the problem is in the error message!

1. Sure there was a typo in the quoted code. But: The typo was not in the code I tried with.
2. I kept testing with a simple prompt to learn about variable resolving and came to the following result:

Code: Select all

SET myString2 HREF:https://www.biconeo-aquascaping.de/mod/shop_admin/?sh_fn=article_edit&sub_fn=set_art_cat&cat_id=36&art_id={{!COL5}}
PROMPT {{myString2}}
nicely gave me the expected URL in the prompt window - the variable WAS resolved.
3. BUT: For a reason that has nothing to do with iMacro I couldn't reach the URL in the given session context. That's a detail of our online shop I don't need to explain here.
4. Ok, I got the quoted error message and this message said again ..."art_id={{!COL5}}" which made me believe the variable was not resolved. In fact iMacro tried to open the correct URL!

I fixed the shop-related issue and now it works. Topic can be closed.
Feel free to delete it - since my assumption was wrong - or change the subject to "misleading error message when URL with variable in can't be reached"

Thank you again
Casi

OK, glad it works...! :D
I will add some "[SOLVED]" to the Thread Title... 8)
(EDIT: Done...)

>

=> About deleting the Thread, well, nope, it is quite an "interesting" Thread actually, with Good Quality :D , and if you found the Runtime Error "misleading" because (by Design), the Runtime Error will pull out the "raw" Statement from the Script itself and when including Vars in that Statement, won't try to interpret those, Chances are that some other Users might make the same Assumption like you did..., and this Thread will then be useful to them... :idea:

=> A Runtime Error is really a "Runtime Error" on the "raw" Statement/Line, and 'PROMPT' is the "Way" to debug a Script and to follow Vars... :idea:

And this Thread is also a perfect Example about "not claiming Bug-Bug-Bug...!" too early... (Well, I did a bit, ah-ah...!) :idea:

>>>

Just before you had opened this (New) Thread, I also posted a mini-Bump in your last/previous Thread from 2 years ago, asking if you had some mini "easy Update" to post in it, if you still remember how you "solved it"... Bug no "big deal" if you don't (remember)...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Post Reply