Click when Button appears and also looping the Precedure without Errors

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
Jonasb
Posts: 2
Joined: Sat Apr 17, 2021 3:03 pm

Click when Button appears and also looping the Precedure without Errors

Post by Jonasb » Sun Apr 18, 2021 8:34 am

Hello together, i m really new here in the forum, hope everything is correct filled in now.

I really need a imacro, can you please help me with that.

Function: i want to visit a Homepage, wenn there is a button i want to push it, othervise i want to visit the homepage again and look again for the buttom to push.

When it is there i want to push the button and also another button on a new Site (Same Tab). Here i want to look for a word on the button (like "reservation")

After the second klick on reservation the Procedure must end, but it would be nice if possible, that i can loop it.

her my code:

URL GOTO=https://www.XXX.de

SET !TIMEOUT_STEP 1

SET !ERRORIGNORE YES

TAG POS=1 TYPE=DIV ATTR=TXT:Termin

TAG POS=1 TYPE=DIV ATTR=TXT:Terminereservieren

TAG POS=1 TYPE=SELECT ATTR=TXT:reservieren (same like the one before?)

SET !ERRORIGNORE NO

SET !TIMEOUT_STEP 1

Can you solve my problem and be my hero?

Regards

Using Imacro Firefox 87.0 (64-Bit) and imacro addin newest version on windows
chivracq
Posts: 9713
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Click when Button appears and also looping the Precedure without Errors

Post by chivracq » Mon Apr 19, 2021 2:20 pm

Jonasb wrote:
Sun Apr 18, 2021 8:34 am
Hello together, i m really new here in the forum, hope everything is correct filled in now.

I really need a imacro, can you please help me with that.

Function: i want to visit a Homepage, wenn there is a button i want to push it, othervise i want to visit the homepage again and look again for the buttom to push.

When it is there i want to push the button and also another button on a new Site (Same Tab). Here i want to look for a word on the button (like "reservation")

After the second klick on reservation the Procedure must end, but it would be nice if possible, that i can loop it.

her my code:

Code: Select all

URL GOTO=https://www.XXX.de

SET !TIMEOUT_STEP 1

SET !ERRORIGNORE YES

TAG POS=1 TYPE=DIV ATTR=TXT:Termin

TAG POS=1 TYPE=DIV ATTR=TXT:Terminereservieren

TAG POS=1 TYPE=SELECT ATTR=TXT:reservieren (same like the one before?)

SET !ERRORIGNORE NO

SET !TIMEOUT_STEP 1
Can you solve my problem and be my hero?

Regards

Using

Code: Select all

Imacro Firefox 87.0 (64-Bit) and imacro addin newest version on windows

Hum, this one Approved as you already improved the Quality "quite a bit", compared to your first Attempt which was "a bit useless", ah-ah...!

I had asked you in my Disapproval to (re-)open the Thread in the "correct" Sub-Forum (=> 'General'), but nope, you've preferred to reopen it again in the 'iMacros for FF' Sub-Forum... Now it's a bit of a hassle to ask the Forum Admin to move your Thread to the correct Sub-Forum...

+ FCIM...!, :mrgreen: Read my Sig...
=> "newest"/"latest" doesn't mean anything on a Tech Forum, simply mention all Versions...
=> iMacros for FF v10.0.2, 'Free'/'PE'...?, FF v87.0 (64-Bit), Win7/10...?

Grrrr..., I "normally" don't answer until a Thread has been moved to the "correct" Sub-Forum, but you'll speed up the Process for next time if you could do all "Things" correctly... :idea:

>>>

Then hum, your Script looks correct to me, without being able to look at the Site, you are already using '!ERRORIGNORE' and a short '!TIMEOUT_STEP'.

And looping, => yep, simply use the Looping Functionality from the Side Panel.
Looping is limited to Max=100 if you are using the 'Free' Version, and you can maybe repeat a few Blocks of Code if you want to increase that Max Looping... (Until Max=50 Lines of Code.)

The "Difficulty" then if I understand correctly is to stop the Script/Looping once the Reservation has been successful...?
=> You probably get some Element displayed like "Your Reservation has been successful...!" that you'll need to tag + using 'FAIL_IF_FOUND'.

Or you can use 'EXTRACT' + 'EVAL()' + 'MacroError()'.

And for both, make sure to disable '!ERRORIGNORE' indeed.
- (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...
Jonasb
Posts: 2
Joined: Sat Apr 17, 2021 3:03 pm

Re: Click when Button appears and also looping the Precedure without Errors

Post by Jonasb » Tue Apr 20, 2021 7:39 pm

Hi,

at first thank you for your Answer

maybe you can also help me with another Problem in the Code. The Code has to be as fast as it can so if ,,TAG POS=2 TYPE=DIV ATTR=TXT:Not<SP>possible" = True the Procedure has to start from the beginning otherwise run further.

Also the second button i want to push is not really a button. The X and Y koordinate is not possible so how can i Search the name on it or Click it otherwise?

here is the Code

<button data-v-1897f198="" type="button" class="right ma-0 btn primary" data-ripple="true" data-rel="ticket-series-event" style="position: relative;"><div class="btn__content">
Push Button
<span data-v-1897f198="" class="customer-count">
1<i data-v-1897f198="" aria-hidden="true" class="eventin-icons icon mr-1">account</i></span></div></button> <!----></div></li></ul></div></div></div> <a href="/ab/start/time" class="no-margin page-series__persen-ban-btn mt-2 btn btn--large default" data-ripple="true"><div class="btn__content"><i aria-hidden="true" class="eventim-icons icon">chevron_left</i>

Thank you so much.

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

Re: Click when Button appears and also looping the Precedure without Errors

Post by chivracq » Tue Apr 20, 2021 9:57 pm

Jonasb wrote:
Tue Apr 20, 2021 7:39 pm
Hi,

at first thank you for your Answer

maybe you can also help me with another Problem in the Code. The Code has to be as fast as it can so if ,,TAG POS=2 TYPE=DIV ATTR=TXT:Not<SP>possible" = True the Procedure has to start from the beginning otherwise run further.

Hum..., "also help me with another Problem" means to me that your "first Qt" got answered/solved, then you could post that working Script... :idea:

I'm then not completely sure I understand what you want "here". (=> would be 10 times easier if I could have a look at the Site myself...!), but then yep, nearly same Technique I already explained for 'MacroError()' but spit out some "1"/"0" from your 'EVAL()' to reuse with "TAG POS=n" for the next Statements in your Script, where "TAG POS=0" won't do anything...

>>>
Jonasb wrote:
Tue Apr 20, 2021 7:39 pm
Also the second button i want to push is not really a button. The X and Y koordinate is not possible so how can i Search the name on it or Click it otherwise?

here is the Code

Code: Select all

<button data-v-1897f198="" type="button" class="right ma-0 btn primary" data-ripple="true" data-rel="ticket-series-event" style="position: relative;"><div class="btn__content">
            Push Button
            <span data-v-1897f198="" class="customer-count">
              1<i data-v-1897f198="" aria-hidden="true" class="eventin-icons icon mr-1">account</i></span></div></button> <!----></div></li></ul></div></div></div> <a href="/ab/start/time" class="no-margin page-series__persen-ban-btn mt-2 btn btn--large default" data-ripple="true"><div class="btn__content"><i aria-hidden="true" class="eventim-icons icon">chevron_left</i>
Thank you so much.

Regards

"Also the second button i want to push is not really a button. The X and Y koordinate is not possible..."
=> That Sentence I don't really understand, the Source Code you've posted is heavily truncated, only the Part from "<button>" to </button>" makes a bit sense..., but I don't recognize anything from the Script you had posted in your OP...

Then you mention the "X/Y Coordinates", which doesn't really make sense... There is an 'X/Y' Mode in iMacros, but that Mode is not supported in your Version... (And I never use it and never "advertize" for it, it is not very reliable, and there is always a "better" Solution...)
- (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