How to wait for an item to load and then press the button?

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
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
AlucardHK
Posts: 4
Joined: Mon Mar 25, 2019 12:41 am

How to wait for an item to load and then press the button?

Post by AlucardHK » Mon Mar 25, 2019 12:54 am

Hello, I have a doubt.

How to wait for an item to load and then press the button?

I speak Spanish, sorry for my bad English xD
Example:
Sin título.png
Sin título2.png
Sin título3.png
how? :/

I am using Firefox 66.0.1 (64-bit), iMacros 10.0.2.1450 free and Windows 10 Pro 64 bits.
Last edited by AlucardHK on Mon Mar 25, 2019 3:29 am, edited 4 times in total.
chivracq
Posts: 8319
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to wait for an item to load and then press the button

Post by chivracq » Mon Mar 25, 2019 1:11 am

AlucardHK wrote:
Mon Mar 25, 2019 12:54 am
Hello, I have a doubt.

How to wait for an item to load and then press the button?

I speak Spanish, sorry for my bad English xD
Example:
Sin título.pngSin título2.pngSin título3.png

how? :/
Yep, welcome to the Forum, but a few "Things" you should pay attention to if you want some/the best Help from the Forum... :idea:

1- You can add a "?" to your Thread Title, you are not sharing a 'How-To' but asking a Qt and looking for Help...

2- CIM...! :mrgreen: (Read my Sig..., and/or the Forum Rules for Tech Info to include when you open a Thread...)
(And if using v10.0.x for FF/CR, mention also if you are using the 'Free' or 'PE' Version...)

3- Try to select the "correct" Sub-Forum when you open a Thread, your Qt has probably nothing specific to the 'iMacros for FF' Sub-Forum, especially if you don't even mention your FCI... (Correct Sub-Forum would have been the 'General' one, but no need to open a Duplicate now...)

OK, now about your Qt...:
Yeah, well, now if you search the Forum a tiny-mini-mini-little-bit, you'll find quite a few similar/identical Threads, this Qt has already been asked (and answered) many times... :idea:

And Advanced Users like me are here to help you if you "really" get stuck somewhere after you've tried "your best" or at least "stg" (=something), but nobody will be writing your Script for you, ah-ah...! :shock:
So..., what have you tried, and where do you get stuck...? (And post your Script...)

Yep..., your Case is very easy to solve if you search the Forum a bit... 8)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
AlucardHK
Posts: 4
Joined: Mon Mar 25, 2019 12:41 am

Re: How to wait for an item to load and then press the button?

Post by AlucardHK » Mon Mar 25, 2019 1:34 am

Thanks for answering!
part of my code is this

Code: Select all

WAIT SECONDS = 1
TAG POS=1 TYPE=YT-FORMATTED-STRING ATTR=TXT:Subscribe<SP>*
WAIT SECONDS = 4
but it is not what I intend
I do not want to use WAIT SECONDS = 4

I find it difficult to find the function in English, since it is not my language but I am trying

thanks and regards!
chivracq
Posts: 8319
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to wait for an item to load and then press the button?

Post by chivracq » Mon Mar 25, 2019 2:16 am

AlucardHK wrote:
Mon Mar 25, 2019 1:34 am
Thanks for answering!
part of my code is this

Code: Select all

WAIT SECONDS = 1
TAG POS=1 TYPE=YT-FORMATTED-STRING ATTR=TXT:Subscribe<SP>*
WAIT SECONDS = 4
but it is not what I intend
I do not want to use WAIT SECONDS = 4

I find it difficult to find the function in English, since it is not my language but I am trying

thanks and regards!
OK, "?" in Thread Title: Good...! :D

FCI still missing, read my Sig again, "im using the free version" is not "good enough", you need to mention the 3 Versions related to iMacros + your Browser, we still don't know which Browser you are using, FF probably unless you completely randomly selected the 'iMacros for FF' Sub-Forum, and you wouldn't be the first one...! with Version + which OS you are using...

And yep Forum Language is English, which is not their native Language for maybe 80% of all Users, me included... :wink:

>>>

My Laptop is now "crying and screaming" and nagging me to reboot to install some Win10 (Pro) Windows Update, v1809 I suspect, that I've been postponing as long as I could... If it's v1809 indeed that it wants to update to, pfff..., I don't know how long it will take, probably more than 30 min, if "everything goes well", as the Win10 CU's usually reinstall many Drivers and reset them to their Default Settings while I've tuned several Advanced Driver Settings, especially for USB and WiFi, so it might take a while before I manage to get my WiFi Connection to work again..., and that I'll need to be able to get some Connection before I'll be able to check the Forum again..., Grrr...!! :roll:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
AlucardHK
Posts: 4
Joined: Mon Mar 25, 2019 12:41 am

Re: How to wait for an item to load and then press the button?

Post by AlucardHK » Mon Mar 25, 2019 3:46 am

Full Config added, sorry for the inconvenience. ;)
chivracq
Posts: 8319
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to wait for an item to load and then press the button?

Post by chivracq » Mon Mar 25, 2019 4:02 am

AlucardHK wrote:
Mon Mar 25, 2019 3:46 am
Full Config added, sorry for the inconvenience. ;)
Oh...!, very good, we finally have your FCI: :D
I am using

Code: Select all

Firefox 66.0.1 (64-bit), iMacros 10.0.2.1450 free and Windows 10 Pro 64 bits.
Sorry for being such a "pain in the ass", but I usually don't even read the Post (and certainly don't answer) when opening a new Thread if that Info is not included... (preferably at the very top of your OP). Remember that for "next time"..., even if you "think" your FCI is not needed... Many Commands are not supported by all Browsers or all Versions or get broken in some Version, whatever...!

OK then..., yep, some mini-Script posted... Yep some hard-coded 'WAIT' Statement can be a "Solution", well..., if you place it before the Click on the 'Subscribe' Button, I don't understand why you place it after...?

But if you searched the Forum, you should have found that generally in such Cases, the "Trick" is simply to "play" with '!TIMEOUT_STEP' that will simply wait for how many Seconds (and will automatically retry every Second) until your Element appears... But I would think the Default 6 Sec for '!TIMEOUT_STEP' should probably already be long enough for that Button to appear or get "activated"..., or does it take longer than 6 Sec...? Or did you change the Default '!TIMEOUT_xxx' Options or do you have some '!TIMEOUT_xxx' (=> '_PAGE' and/or '_STEP') Command(s) earlier in your Script...?

Might speed up "the Process" btw if you posted your whole Script, I won't be enumerating all Commands from the Commands Reference to check if by any chance you might be using any... I can't guess what you have earlier in your Script before the 'Subscribe' Button part... :idea:
And if you don't post the URL, I won't be doing any Testing for you, I won't be retyping the URL from your Screenshot(s)...

>>>

Oh...!, and my WinUpdate went "OK", in about 12 Min, evven if I had "the Feeling" that Booting was taking clearly longer than "usual", I'll see..., but I'm still at v1803, so this one which only installed a few KB's, didn't reinstall any Drivers etc... So I should be "settled" now for a while..., I hope at least... 8)
The WinUpdate Process is a complete Hassle with Win10, is maybe OK for Grandpa's and Grandma's and "(Ex-)GirlFriends", but not for "Advanced" Users and IT-Pro's, pfff...!! :roll:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
AlucardHK
Posts: 4
Joined: Mon Mar 25, 2019 12:41 am

Re: How to wait for an item to load and then press the button?

Post by AlucardHK » Mon Mar 25, 2019 3:36 pm

URL: https://www.ytmonster.net/exchange/subscribers# (registration is needed)
my script:
What it does is: press Subscribe, send it to YouTube and subscribe to a certain channel, but I can not make it work correctly because it has different loading times the "item" (is a Font Awesome icon)

Code: Select all

VERSION BUILD=10022823
TAG POS=1 TYPE=DIV ATTR=ID:subText
WAIT SECONDS = 3
TAB T=2
WAIT SECONDS = 1
TAG POS=1 TYPE=YT-FORMATTED-STRING ATTR=TXT:Subscribe<SP>*
WAIT SECONDS = 4
TAB T=1
WAIT SECONDS = 3
TAG POS=2 TYPE=DIV ATTR=TXT:Verify<SP>Subscription
WAIT SECONDS = 15
TAB CLOSEALLOTHERS
Last edited by AlucardHK on Mon Mar 25, 2019 11:18 pm, edited 1 time in total.
chivracq
Posts: 8319
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to wait for an item to load and then press the button?

Post by chivracq » Mon Mar 25, 2019 9:07 pm

AlucardHK wrote:
Mon Mar 25, 2019 3:36 pm
URL: https://www.ytmonster.net/exchange/subscribers# (registration is needed)
I made a video so you understand what I want to do xD
https://www.youtube.com/watch?v=s80bvzGXiZM
my script:
What it does is: press Subscribe, send it to YouTube and subscribe to a certain channel, but I can not make it work correctly because it has different loading times the "item" (is a Font Awesome icon)

Code: Select all

VERSION BUILD=10022823
TAG POS=1 TYPE=DIV ATTR=ID:subText
WAIT SECONDS = 3
TAB T=2
WAIT SECONDS = 1
TAG POS=1 TYPE=YT-FORMATTED-STRING ATTR=TXT:Subscribe<SP>*
WAIT SECONDS = 4
TAB T=1
WAIT SECONDS = 3
TAG POS=2 TYPE=DIV ATTR=TXT:Verify<SP>Subscription
WAIT SECONDS = 15
TAB CLOSEALLOTHERS
Ah...!, OK for your Script, no '!TIMEOUT_xxx' Statements then, which means the Value for '!TIMEOUT_STEP' should be the Default 6 Sec unless you've modified the Value for '!TIMEOUT_PAGE' (= 60 Sec) in the Default General Options for iMacros.
And no use of '!ERRORIGNORE' either, which should give you some Info if any Field(s) is/are not found after those 6 Sec.

The Version included in this Script is a bit "odd" though, probably from iMB v10.0.2 I think, which would mean that this Script is about 5 years old... :o

But then, yep..., I already gave you the most probable and easiest Solution, by "tuning" yourself '!TIMEOUT_STEP' in your Script, that's very probably the way to go...

(And to further "manage" your "Expectations", I only reacted to this Thread because of the very common "Wait for an Element to appear" Functionality/Scenario, but I usually don't help for Social Media and automated fake Like/Follow/Subscribe/Comment, nor if any Competition (Games/Voting) or some Financial Gain is involved..., so I guess I won't try to help you any further for this kind of Script with iMacros... :| )
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Post Reply