Repeating a click on webpage button

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
Stevefourimacro
Posts: 5
Joined: Thu Mar 09, 2017 1:48 am

Repeating a click on webpage button

Post by Stevefourimacro » Thu Mar 09, 2017 1:57 am

Hi
I am trying to get the following macro to play on a specific webpage to click a "book dates" button repeatedly . When played on that site, it clicks once then does not proceed to the the next clicks. I am using Chrome with version 8.44 imacro with Win 10

TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates
TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates
TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Repeating a click on webpage button

Post by chivracq » Thu Mar 09, 2017 3:10 am

Stevefourimacro wrote:Hi
I am trying to get the following macro to play on a specific webpage to click a "book dates" button repeatedly . When played on that site, it clicks once then does not proceed to the the next clicks. I am using Chrome with version 8.44 imacro with Win 10

Code: Select all

TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates
TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates
TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates
Okay..., let me check..., hum found some interesting Info, but hum not enough, ask OP to read the Forum Rules...!
=> (F)CIM...! Oops + Shocking + Shame...! :oops: :shock: :roll:
I am using

Code: Select all

Chrome with version 8.44 imacro with Win 10
=> CR Version missing... + I didn't see any URL to have a look at the Site, pfff...! :roll:
(Ah-Ah-Ah...!, This must be an "Amateur", oops...! :oops: )

(We are missing the CR Version, CR56...?, and the URL for the Site, sorry but too much hassle for "generic" Advice if URL is not mentioned...)

>

Reply meant a bit as a joke, but @OP, reply "correctly" for all Qt's asked, I won't follow up otherwise... :idea:
(Your original OP is a bit useless @OP, pfffpfffppffffpfff...!)
- (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...
Stevefourimacro
Posts: 5
Joined: Thu Mar 09, 2017 1:48 am

Re: Repeating a click on webpage button

Post by Stevefourimacro » Thu Mar 09, 2017 5:56 am

Chrome Version 56.0.2924.87 (64-bit)
Imacro 8.44
Win 10

Example of script:
VERSION BUILD=844 RECORDER=CR
URL GOTO=https://www.recreation.gov/switchBookin ... hosen=true
TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates
TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates
TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates
TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates

Problem: does not repeat click on button
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Repeating a click on webpage button

Post by chivracq » Thu Mar 09, 2017 7:08 am

Stevefourimacro wrote:

Code: Select all

Chrome Version 56.0.2924.87 (64-bit)
Imacro 8.44
Win 10
Example of script:

Code: Select all

VERSION BUILD=844 RECORDER=CR
URL GOTO=https://www.recreation.gov/switchBookingAction.do?contractCode=NRSO&parkId=71925&siteId=81350&camparea=0&selStatus=aaaaaaa&matrixHasError=false&dateToday=09%2F09%2F2017&currentMaximumWindow=12&dateMinWindow=03%2F08%2F2017&dateMaxWindow=03%2F09%2F2018&arvdate=09%2F09%2F2017&arrivaldate=Sat+Sep+09+2017&lengthOfStay=7&dateChosen=true
TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates
TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates
TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates
TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates
Problem: does not repeat click on button
I am trying to get the following macro to play on a specific webpage to click a "book dates" button repeatedly . When played on that site, it clicks once then does not proceed to the the next clicks.
OK, now we are "talking", posting a "fake" Post with all Info (which should have been included in OP), for me to have a look, no need to react...
- (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...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Repeating a click on webpage button

Post by chivracq » Thu Mar 09, 2017 7:13 am

Ah oops, but I guess I was or you were too late...:
The date you have selected cannot be reserved at this time. Please try again later at 10:00 AM Mar 9 EST.
Find Other Cabins
MIDDLE DANGEROUS RIVER CABIN, AK
Sounds kinky-kinky-dangerous, ouf-ouf...!! :|
=>Yes, mammy!, go for the "EXTREME DANGEROUS CLIFF CABINS"..., I don't play otherwise...! (Or I want a LOT of candy..., gniarf-gniarf...!)
- (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...
Stevefourimacro
Posts: 5
Joined: Thu Mar 09, 2017 1:48 am

Re: Repeating a click on webpage button

Post by Stevefourimacro » Thu Mar 09, 2017 2:38 pm

No actually too early. The point is to have the macro click on the reserve button continuously until booking is availabie.

As I said, the macro does not do that. Clicks once than that is it.

Today the previous URL is not a good example. Try

https://www.recreation.gov/switchBookin ... hosen=true

See that the macro (TAGs) only clicks once, not repeatedly as I would want.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Repeating a click on webpage button

Post by chivracq » Thu Mar 09, 2017 6:42 pm

Stevefourimacro wrote:No actually too early. The point is to have the macro click on the reserve button continuously until booking is availabie.

As I said, the macro does not do that. Clicks once than that is it.

Today the previous URL is not a good example. Try

https://www.recreation.gov/switchBookin ... hosen=true

See that the macro (TAGs) only clicks once, not repeatedly as I would want.
Link works now indeed, but hum..., I've seen quite a few creepy Movies with such a "River Cabin", there are always ugly Monsters at night around such Cabins (and even in the water), are you sure you want to go there...!?, creepy-creepy...!

But OK, a bit more "seriously", I would think the easiest way for you is to loop your Script (with '!ERRORIGNORE'), with the 'URL GOTO' on the Page as I guess it won't refresh by itself and to "try" to click on the 'Book these Dates' Button which will only appear at some point... Is that correct...?

In order to click only once on this Button, you need to first check for its presence, then click on it and then using 'EVAL()' + 'MacroError()' to abort the Macro with stg like:

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
SET !ERRORIGNORE YES
SET !EXTRACT_TEST_POPUP NO
SET !TIMEOUT_STEP 1
TAB T=1

URL GOTO=https://www.recreation.gov/switchBookingAction.do?contractCode=NRSO&parkId=71924&siteId=81349&camparea=0&selStatus=null&matrixHasError=true&dateToday=09%2F12%2F2017&currentMaximumWindow=12&dateMinWindow=03%2F09%2F2017&dateMaxWindow=03%2F09%2F2018&arvdate=09%2F12%2F2017&arrivaldate=Tue+Sep+12+2017&lengthOfStay=1&dateChosen=true
TAG POS=1 TYPE=SPAN ATTR=ID:cgroundName
TAG POS=2 TYPE=DIV ATTR=TXT:Cabin,<SP>Loop:Y07,<SP>AREA<SP>ALSEK<SP>RIVER<SP>CABIN

'Checking if 'Book these Dates' Button is present:
SET !EXTRACT NULL
TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates EXTRACT=TXT
'=> Extracted: "Book these Dates"

TAG POS=1 TYPE=BUTTON FORM=ID:booksiteform ATTR=ID:btnbookdates

SET Mini_Report <SP><SP>//<SP><SP>No<SP>Error...!!<BR><BR>
ADD Mini_Report Booking<SP>successful<SP>at<SP>{{!NOW:yyyy-mm-dd_hhhnn}}...!<BR><BR>

'Abort Macro/Looping if Button was found:
SET !ERRORIGNORE NO
SET Abort_Macro EVAL("var s='{{!EXTRACT}}'; if(s!='#EANF#'){MacroError('{{Mini_Report}}');};")
SET !ERRORIGNORE YES

WAIT SECONDS=15
(Tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10-x64.)

The first 2 'TAG' Statements are not really needed but could be used for some extra Checking that we are on the "right" Page, + for some Relative Positioning.

The current Check/Macro Abort is done by checking if the 'Book these Dates' Button is present or not, it could be done by extracting some specific Msg appearing after a successful Booking...
- (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...
Stevefourimacro
Posts: 5
Joined: Thu Mar 09, 2017 1:48 am

Re: Repeating a click on webpage button

Post by Stevefourimacro » Thu Mar 09, 2017 7:06 pm

I'll try with your suggestions. I appreciate your help.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Repeating a click on webpage button

Post by chivracq » Thu Mar 09, 2017 7:32 pm

Stevefourimacro wrote:I'll try with your suggestions. I appreciate your help.
Oh...!, you could already answer/confirm the "Is this correct...?" Assumption I made about the Button... :?:
(Because the "Mechanism" I used in the Macro is based on that Assumption, and if it is not correct, then... well..., the Macro won't exactly do what you want, ah-ah...!)
- (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...
Stevefourimacro
Posts: 5
Joined: Thu Mar 09, 2017 1:48 am

Re: Repeating a click on webpage button

Post by Stevefourimacro » Thu Mar 09, 2017 7:54 pm

Yes, you were correct. There is a very short refresh of the button. Click it is gone, and then it comes back instantly it seems.

You are not correct about the creepy cabins! You should check them out!
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Repeating a click on webpage button

Post by chivracq » Fri Mar 10, 2017 1:56 am

Stevefourimacro wrote:Yes, you were correct. There is a very short refresh of the button. Click it is gone, and then it comes back instantly it seems.

You are not correct about the creepy cabins! You should check them out!
OK, good to hear then, I'll be interested to hear if the Script works indeed like you expect, and if you understand the "Mechanism" I used to implement it...

About your Cabins, ah-ah...!, a bit far for me as I live in Europe (NL), the only Cabin I like is this one...! :oops:
- (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