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.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Repeating a click on webpage button

by Stevefourimacro on Wed Mar 08, 2017 6:57 pm

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
Stevefourimacro
 
Posts: 5
Joined: Wed Mar 08, 2017 6:48 pm

Re: Repeating a click on webpage button

by chivracq on Wed Mar 08, 2017 8:10 pm

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)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...
chivracq
 
Posts: 6471
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Repeating a click on webpage button

by Stevefourimacro on Wed Mar 08, 2017 10:56 pm

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/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
Stevefourimacro
 
Posts: 5
Joined: Wed Mar 08, 2017 6:48 pm

Re: Repeating a click on webpage button

by chivracq on Thu Mar 09, 2017 12: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)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...
chivracq
 
Posts: 6471
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Repeating a click on webpage button

by chivracq on Thu Mar 09, 2017 12: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)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...
chivracq
 
Posts: 6471
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Repeating a click on webpage button

by Stevefourimacro on Thu Mar 09, 2017 7:38 am

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.
Stevefourimacro
 
Posts: 5
Joined: Wed Mar 08, 2017 6:48 pm

Re: Repeating a click on webpage button

by chivracq on Thu Mar 09, 2017 11:42 am

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)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...
chivracq
 
Posts: 6471
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Repeating a click on webpage button

by Stevefourimacro on Thu Mar 09, 2017 12:06 pm

I'll try with your suggestions. I appreciate your help.
Stevefourimacro
 
Posts: 5
Joined: Wed Mar 08, 2017 6:48 pm

Re: Repeating a click on webpage button

by chivracq on Thu Mar 09, 2017 12: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)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...
chivracq
 
Posts: 6471
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Repeating a click on webpage button

by Stevefourimacro on Thu Mar 09, 2017 12: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!
Stevefourimacro
 
Posts: 5
Joined: Wed Mar 08, 2017 6:48 pm

Re: Repeating a click on webpage button

by chivracq on Thu Mar 09, 2017 6:56 pm

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)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...
chivracq
 
Posts: 6471
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to General Support & Discussions

Who is online

Users browsing this forum: No registered users and 5 guests

-->