Imacros Xpath loop plus other options

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
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
anirnet
Posts: 8
Joined: Sat Jan 05, 2019 6:54 am

Imacros Xpath loop plus other options

Post by anirnet » Sat Jan 05, 2019 7:07 am

Hi

I really need help as a total newbie to imacros

I need to go through 64 listings in a page, i mean by that, opening them in a second tab then click two buttons before closing it and going back to T1 and repeat the process for all the 64 listings.

These are the first 6 xpaths of the listings. i can't put all of them in the iim file.

Code: Select all

TAG XPATH=//*[@id="reorderable-listing-results"]/li[1]/div/a/div[1]/div[1]/div[1]/div/div/div/img
TAG XPATH=//*[@id="reorderable-listing-results"]/li[2]/div/a/div[1]/div[1]/div[1]/div/div/div/img
TAG XPATH=//*[@id="reorderable-listing-results"]/li[3]/div/a/div[1]/div[1]/div[1]/div/div/div/img
TAG XPATH=//*[@id="reorderable-listing-results"]/li[4]/div/a/div[1]/div[1]/div[1]/div/div/div/img
TAG XPATH=//*[@id="reorderable-listing-results"]/li[5]/div/a[1]/div[1]/div/div[1]/div/div/div/img
TAG XPATH=//*[@id="reorderable-listing-results"]/li[6]/div/a[1]/div[1]/div[1]/div[1]/div/div/div/img
is using the Xpath methode the right choice for this purpose?
If not what is the best and easy way to loop the lines ? i mean taking in consideration opening each listing individually to click other buttons.

Thank you so much

my Config :

Imacros : 10.0.5
Chrome : Version 71.0.3578.98 (Official Build) (64-bit)
Windows 10 pro 64-bit
Last edited by anirnet on Sat Jan 05, 2019 7:43 am, edited 1 time in total.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Imacros Xpath loop plus other options

Post by chivracq » Sat Jan 05, 2019 7:29 am

anirnet wrote:
Sat Jan 05, 2019 7:07 am
Hi

I really need help as a total newbie to imacros

I need to go through 64 listings in a page, i mean by that, opening them in a second tab then click two buttons before closing it and going back to T1 and repeat the process for all the 64 listings.

These are the first 6 xpaths of the listings. i can't put all of them in the iim file.

Code: Select all

TAG XPATH=//*[@id="reorderable-listing-results"]/li[1]/div/a/div[1]/div[1]/div[1]/div/div/div/img
TAG XPATH=//*[@id="reorderable-listing-results"]/li[2]/div/a/div[1]/div[1]/div[1]/div/div/div/img
TAG XPATH=//*[@id="reorderable-listing-results"]/li[3]/div/a/div[1]/div[1]/div[1]/div/div/div/img
TAG XPATH=//*[@id="reorderable-listing-results"]/li[4]/div/a/div[1]/div[1]/div[1]/div/div/div/img
TAG XPATH=//*[@id="reorderable-listing-results"]/li[5]/div/a[1]/div[1]/div/div[1]/div/div/div/img
TAG XPATH=//*[@id="reorderable-listing-results"]/li[6]/div/a[1]/div[1]/div[1]/div[1]/div/div/div/img
is using the Xpath methode the right choice for this purpose?
If not what is the best and easy way to loop the lines ? i mean taking in consideration opening each listing individually to click other buttons.

Thank you so much
CIM...! :mrgreen: (... => For me to have a look, read my Sig...)
- (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...
anirnet
Posts: 8
Joined: Sat Jan 05, 2019 6:54 am

Re: Imacros Xpath loop plus other options

Post by anirnet » Sat Jan 05, 2019 7:45 am

Sorry i was in a rush I didn't really pay attention to that.
thank you for the reminder and the quick reply.
I have updated my original post
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Imacros Xpath loop plus other options

Post by chivracq » Sat Jan 05, 2019 7:46 am

FCI:
my Config :

Code: Select all

Imacros : 10.0.5
Chrome : Version 71.0.3578.98 (Official Build) (64-bit)
Windows 10 pro 64-bit
v10.0.5 for CR: => 'Free' or 'PE'...?
Last edited by chivracq on Sat Jan 05, 2019 7:48 am, edited 1 time in total.
- (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...
anirnet
Posts: 8
Joined: Sat Jan 05, 2019 6:54 am

Re: Imacros Xpath loop plus other options

Post by anirnet » Sat Jan 05, 2019 7:48 am

I'm using the free version
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Imacros Xpath loop plus other options

Post by chivracq » Sat Jan 05, 2019 7:55 am

OK, URL not posted, => I can't have a look at your Site, but I would think, "find" some Element on the Page to use as "Anchor" and use 'Relative Positioning' with 'TAG POS=R{{!LOOP}}' for each 'IMG' Element... :idea:
And you can then loop your Script 64x times for each "Listing" and the corresponding Actions for 1 Listing per Loop...
(Can loop up to 100x times for v10.0.x for CR/FF 'Free'.)
- (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...
anirnet
Posts: 8
Joined: Sat Jan 05, 2019 6:54 am

Re: Imacros Xpath loop plus other options

Post by anirnet » Sat Jan 05, 2019 8:03 am

chivracq wrote:
Sat Jan 05, 2019 7:55 am
OK, URL not posted, => I can't have a look at your Site, but I would think, "find" some Element on the Page to use as "Anchor" and use 'Relative Positioning' with 'TAG POS=R{{!LOOP}}' for each 'IMG' Element... :idea:
And you can then loop your Script 64x times for each "Listing" and the corresponding Actions for 1 Listing per Loop...
(Can loop up to 100x times for v10.0.x for CR/FF 'Free'.)
Wow! I honnestly didn't get what you said.
But i'll cover the whole situation so you can have an idea of what i exactly need.

here is the exacte page i'm on right now : https://www.etsy.com/search?q=boho%20shirt
what i'm trying to do is go through those listings which are 64 ones, open them and click the two favorite buttons (shop favorite) and the (product favorite) buttons, close the tab and go back to T1 to repeat the process for the rest of the listings. and after i'm done with those listings i would like to move to the next page and do the same thing non-stop.

so basically this what i try to do, but i couldn't figure out how.

Thank you so much
anirnet
Posts: 8
Joined: Sat Jan 05, 2019 6:54 am

Re: Imacros Xpath loop plus other options

Post by anirnet » Sat Jan 05, 2019 8:08 am

I made this one but it lacks the option to move to the next page. also it works by play loop mode by setting how many times it will loop
I don't think it's efficient

Code: Select all

SET !ERRORIGNORE YES
SET !LOOP 1
TAG XPATH=//*[@id="reorderable-listing-results"]/li[{{!LOOP}}]/div/a/div[1]/div[1]/div[1]/div/div/div/img
TAB T=2
WAIT SECONDS=2
TAG POS=1 TYPE=SPAN ATTR=TXT:Favorite<SP>shop
WAIT SECONDS=2
TAG XPATH=//*[@id="listing-body"]/div[1]/div[1]/div[1]/button/div/span/span[1]
WAIT SECONDS=2
TAB CLOSE
TAB T=1
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Imacros Xpath loop plus other options

Post by chivracq » Sat Jan 05, 2019 8:25 am

anirnet wrote:
Sat Jan 05, 2019 8:03 am
Wow! I honnestly didn't get what you said.
But i'll cover the whole situation so you can have an idea of what i exactly need.

here is the exacte page i'm on right now : https://www.etsy.com/search?q=boho%20shirt
what i'm trying to do is go through those listings which are 64 ones, open them and click the two favorite buttons (shop favorite) and the (product favorite) buttons, close the tab and go back to T1 to repeat the process for the rest of the listings. and after i'm done with those listings i would like to move to the next page and do the same thing non-stop.

so basically this what i try to do, but i couldn't figure out how.

Thank you so much
Yep, always much easier with the URL...

=> As "Anchor" you can use the 'Etsy' Site Logo or the 'All categories' Link for example..., but it looks like your Images are also the only Images on the Page, meaning 'R-POS' is not even needed and you can directly use 'TAG POS={{!LOOP}}' to loop through them all... :idea:
anirnet wrote:
Sat Jan 05, 2019 8:03 am
I made this one but it lacks the option to move to the next page. also it works by play loop mode by setting how many times it will loop
I don't think it's efficient

Code: Select all

SET !ERRORIGNORE YES
SET !LOOP 1
TAG XPATH=//*[@id="reorderable-listing-results"]/li[{{!LOOP}}]/div/a/div[1]/div[1]/div[1]/div/div/div/img
TAB T=2
WAIT SECONDS=2
TAG POS=1 TYPE=SPAN ATTR=TXT:Favorite<SP>shop
WAIT SECONDS=2
TAG XPATH=//*[@id="listing-body"]/div[1]/div[1]/div[1]/button/div/span/span[1]
WAIT SECONDS=2
TAB CLOSE
TAB T=1
OK, fine also I guess if you prefer to use 'XPATH' (which I never use myself actually)...

To click on the 'Next' Page, you would need to use 'EVAL()' + 'Modulo[64]' but this won't work as you can only loop your Script 100x times with the 'Free' Version, and you can't either include the full Code for one full Page with 64 Images as the Limit per Script is 50 Lines of Code.
=> You'll have to cope with the Limitations for the 'Free' Version and you will need to manually navigate to the next Page each time and to loop your Macro 64x times per Page... :oops:

And to be honest, I'm quite "impressed", I think you are probably the first "Tee-Shirt Fetishist" I ever come across, ready to like 61,534 Tee-Shirts...! :shock:
You might deserve a Place in the Guinness Book of Records maybe, woaw, super cool...! 8)
- (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...
anirnet
Posts: 8
Joined: Sat Jan 05, 2019 6:54 am

Re: Imacros Xpath loop plus other options

Post by anirnet » Sat Jan 05, 2019 8:48 am

Thank you man I really don't know how to apply this, but i'll try, since i have 0 knowledge in the field of Imacros, this is my first time using it.

haha regarding the tshirt liking, well, I actually do that for traffic purposes and exchanging favorites with other shop owners. i must be crazy to do that just for the tshirts :lol: :lol: :lol:

Thanks alot I appreciate it for taking time to answer my questions :D
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Imacros Xpath loop plus other options

Post by chivracq » Sat Jan 05, 2019 9:00 am

anirnet wrote:
Sat Jan 05, 2019 8:48 am
Thank you man I really don't know how to apply this, but i'll try, since i have 0 knowledge in the field of Imacros, this is my first time using it.

haha regarding the tshirt liking, well, I actually do that for traffic purposes and exchanging favorites with other shop owners. i must be crazy to do that just for the tshirts :lol: :lol: :lol:

Thanks alot I appreciate it for taking time to answer my questions :D
Yeah well, you would actually need the (paying) 'PE' Version which doesn't have those 50-Lines + 100-Loops Limitations, or if you can use some older Version like v8.9.7 for FF for example which doesn't have any Limitation (+ FF v55.0.3 (Portable) or Pale Moon or WaterFox) if you don't want to pay for the 'PE' Version on CR...
(Or you may want to have a look at some other Tools like 'Kantu' or 'Katalon' ('Katalon' has some Add-on/Plugin for CR), or even 'Selenium' which can also do Web-Automation... :idea: )
- (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...
anirnet
Posts: 8
Joined: Sat Jan 05, 2019 6:54 am

Re: Imacros Xpath loop plus other options

Post by anirnet » Sat Jan 05, 2019 9:14 am

Yeah well, you would actually need the (paying) 'PE' Version which doesn't have those 50-Lines + 100-Loops Limitations, or if you can use some older Version like v8.9.7 for FF for example which doesn't have any Limitation (+ FF v55.0.3 (Portable) or Pale Moon or WaterFox) if you don't want to pay for the 'PE' Version on CR...
(Or you may want to have a look at some other Tools like 'Kantu' or 'Katalon' ('Katalon' has some Add-on/Plugin for CR), or even 'Selenium' which can also do Web-Automation... :idea: )
That's actually a good Idea, i'll try older versions on FF and try to apply the script.

you're absolutely the best!! thank you so much for suggesting that.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Imacros Xpath loop plus other options

Post by chivracq » Sat Jan 05, 2019 9:34 am

anirnet wrote:
Sat Jan 05, 2019 9:14 am
Yeah well, you would actually need the (paying) 'PE' Version which doesn't have those 50-Lines + 100-Loops Limitations, or if you can use some older Version like v8.9.7 for FF for example which doesn't have any Limitation (+ FF v55.0.3 (Portable) or Pale Moon or WaterFox) if you don't want to pay for the 'PE' Version on CR...
(Or you may want to have a look at some other Tools like 'Kantu' or 'Katalon' ('Katalon' has some Add-on/Plugin for CR), or even 'Selenium' which can also do Web-Automation... :idea: )
That's actually a good Idea, i'll try older versions on FF and try to apply the script.

you're absolutely the best!! thank you so much for suggesting that.
"Older" Versions of iMacros for FF... (Go for v8.9.7...!) :wink:
- (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...
anirnet
Posts: 8
Joined: Sat Jan 05, 2019 6:54 am

Re: Imacros Xpath loop plus other options

Post by anirnet » Sat Jan 05, 2019 8:24 pm

Heyy!

I finally made it work by putting all the lines for the 64 listings since there are no limitations. and at the end of the script i added the pagination click. so now the play loop number represents how many pages i wanna go through.
I can Die now :lol: :lol: :lol: :mrgreen: haha

PS: i had to downgrade the FF version to 48 to make the v8.9.7 work. otherwise it says the file is corrupt in recent ff versions.

Thanks a bunch amigo, you helped me solving my problem.

cheers
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Imacros Xpath loop plus other options

Post by chivracq » Sat Jan 05, 2019 8:41 pm

anirnet wrote:
Sat Jan 05, 2019 8:24 pm
Heyy!

I finally made it work by putting all the lines for the 64 listings since there are no limitations. and at the end of the script i added the pagination click. so now the play loop number represents how many pages i wanna go through.
I can Die now :lol: :lol: :lol: :mrgreen: haha

PS: i had to downgrade the FF version to 48 to make the v8.9.7 work. otherwise it says the file is corrupt in recent ff versions.

Thanks a bunch amigo, you helped me solving my problem.

cheers
Yep, very nice, that's indeed "a way" to do it...! :D

Hum, v8.9.7 for FF should work until FF56, I use it myself on FF v55.0.3, and it should work also on PM27 and probably PM28 and I know it works also on Waterfox but I don't know exactly on what Version (as I only use FF and PM myself)...
But for all those Browsers, you might need indeed to disable some 'Add-ons Compatibility Check' Setting in 'about:config' to be able to "force" installing v8.9.7.
But I guess if it works on FF48, then that's also just as good for you... :wink:
- (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