Bridgend council

Hi
I am not able to write the data from next page of Bridgend council
URL is - http://planning.bridgend.gov.uk/

Total no of pages pattern is as below -

1
2
3
4

Regards

That request is very straight

That request is very straight forward. Maybe this post will help you.

My URL is -

My URL is - http://planning.bridgend.gov.uk/

My next page parameters are as below -

ListMode SEARCH 1 GET
__EVENTTARGET ctl00$ContentPlaceHolder1$gvPlanning 2 POST
__EVENTARGUMENT Page$2 3 POST
__LASTFOCUS 4 POST
__VIEWSTATE ~#VIEWSTATE#~ 5 POST
__VIEWSTATEGENERATOR ~#VIEWSTATEGENERATOR#~ 6 POST
__VIEWSTATEENCRYPTED 7 POST
__EVENTVALIDATION ~#EVENTVALIDATION#~ 8 POST
ctl00$ContentPlaceHolder1$ddlbSize 15 9 POST

For __EVENTARGUMENT parameter I have passed the value as Page$2

And the number of pages pattern in result page is as below -

1
2
3
4

My record counter script is -

String record = dataRecord.get("TABLEDATA");
session.log("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ :: ");

int recordsOnPage = Integer.parseInt(session.getVariable("NUMBER_MATCHES"));

if(record!= null) {
String[] trData = record.split("
session.log("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ :: " + trData.toString());
if(trData != null && trData.length > 0) {
int trCounter = trData.length - 1;
session.log("Total records on the page :: "+trCounter);
session.log("Total records read :: "+ (recordsOnPage + trCounter));

My loop for pages script is -

int page = Integer.parseInt(session.getVariable("PAGE"));
int pageCounter = 2;

if( session.getVariable( "TOTAL_PAGES" ) != null){
int totalNumberOfPages = Integer.parseInt(session.getVariable( "TOTAL_PAGES" ));
for(i=1; i < totalNumberOfPages; i++) {

session.setVariable("PAGECOUNTER", pageCounter);
session.setVariable("TOKEN",session.getVariable("TOKEN"));

session.scrapeFile("Third");
pageCounter = pageCounter + 1;
}
}

// Check exit condition

int totalNumberOfRecords = Integer.parseInt(session.getVariable( "NUMBER_MATCHES"));;
String numberMatches = session.getVariable( "NUMBER_MATCHES");
String recordsCollectedCounter = session.getVariable( "RECORDS_COLLECTED");
if(numberMatches.equalsIgnoreCase("One")) {
totalNumberOfRecords = 1;
}else{
totalNumberOfRecords = Integer.parseInt(numberMatches);
}

session.log("**************recordsCollectedCounter *******" + recordsCollectedCounter);
session.log("**************totalNumberOfRecords ******* " + totalNumberOfRecords);

if(recordsCollectedCounter != null
&& !"".equals(recordsCollectedCounter.trim())
&& Integer.parseInt(recordsCollectedCounter) == totalNumberOfRecords) {
session.setVariable( "EXECUTION_STATUS", "SUCCESS" );
session.log("**************EXECUTION_STATUS ******* SUCCESS");
}else{
session.setVariable("SESSION_STATUS_CODE","RECORDS_MISMATCHED");
}

session.log("**************SESSION_STATUS_CODE *******" + session.getVariable("SESSION_STATUS_CODE"));

Kindly help me to get the records on the next page

Could you tell me the steps

Could you tell me the steps to take on the site so I can proxy it myself?

The pages I captured as below

The pages I captured as below -
1. http://planning.bridgend.gov.uk/
I enter the received dates, such as 1-Aug-2016 to 15-Aug-2016

2. I click on search page and getting the result page as
http://planning.bridgend.gov.uk/plaDetails.aspx?ListMode=SEARCH

The parameters for result page are

__EVENTTARGET 1 POST
__EVENTARGUMENT 2 POST
__VIEWSTATE ~#VIEWSTATE#~ 3 POST
__VIEWSTATEGENERATOR ~#VIEWSTATEGENERATOR#~ 4 POST
__EVENTVALIDATION ~#EVENTVALIDATION#~ 5 POST
ctl00$ContentPlaceHolder1$txtAppNo 6 POST
ctl00$ContentPlaceHolder1$txtLoc 7 POST
ctl00$ContentPlaceHolder1$txtEasting 8 POST
ctl00$ContentPlaceHolder1$txtNorthing 9 POST
ctl00$ContentPlaceHolder1$txtProposal 10 POST
ctl00$ContentPlaceHolder1$ddlParish 11 POST
ctl00$ContentPlaceHolder1$ddlWard 12 POST
ctl00$ContentPlaceHolder1$txtAppName 13 POST
ctl00$ContentPlaceHolder1$txtAgent 14 POST
ctl00$ContentPlaceHolder1$txtRecFrom ~#FROMDATE#~ 15 POST
ctl00$ContentPlaceHolder1$txtRecTo ~#TODATE#~ 16 POST
ctl00$ContentPlaceHolder1$txtDecFrom 17 POST
ctl00$ContentPlaceHolder1$txtDecTo 18 POST
ctl00$ContentPlaceHolder1$txtAppFrom 19 POST
ctl00$ContentPlaceHolder1$txtAppTo 20 POST
ctl00$ContentPlaceHolder1$ddlCategory 21 POST
ctl00$ContentPlaceHolder1$Button1 Search 22 POST

3. For capturing the next page records I click on 2 and go to the next page with below URL
http://planning.bridgend.gov.uk/plaDetails.aspx

The parameters for next page are

ListMode SEARCH 1 GET
__EVENTTARGET ctl00$ContentPlaceHolder1$gvPlanning 2 POST
__EVENTARGUMENT Page~#PAGECOUNTER# 3 POST
__LASTFOCUS 4 POST
__VIEWSTATE ~#VIEWSTATE#~ 5 POST
__VIEWSTATEGENERATORa ~#VIEWSTATEGENERATOR#~ 6 POST
__VIEWSTATEENCRYPTED 7 POST
__EVENTVALIDATION ~#EVENTVALIDATION#~ 8 POST
ctl00$ContentPlaceHolder1$ddlbSize 15 9 POST

I am able to get the records for result page but not getting records on next page. something wrong related to record counter script. How can I attach my session over here

Thank you

I attached a session to this

I attached a session to this thread with an example.