473,322 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Microsoft application center test...oResponse.body parsing

Hello everyone,

I am fairly new to MACT, I am currently trying to parse the
oResponse.Body to retrive a dynamic values...store in an array and then
randomly post those values.

Does anyone have any sample code on how to parse the oResponse.Body?

This is what I have so far but I cannot seem to get the value I'm
trying to pick up.
I have been struguling on getting this values for a couple of days now.

The line of source code I'm trying to pickup displays as follows:
<form name="form2" action="/emobile/l.cfm" method="post">
<input type="hidden" name="params"
value="RAND;3928;P_TYPE;0;MYSTATUS;5;AREA;2;SD;0;S EARCH;Search;"/>

I would like to grab value and store it somewhere.

Thanks in advance.

'--------------------------------------------
' Here I'm posting my random search critieria
' and then it will return a page with the results in a form
' of links. The links area property address'
'

Sub SendRequest9()
Dim oConnection, oRequest, oResponse, oHeaders, strStatusCode
If fEnableDelays = True then Test.Sleep (20051)
Set oConnection = Test.CreateConnection(sSiteName, 80, false)
If (oConnection is Nothing) Then
Test.Trace "Error: Unable to create connection to " & sSiteName
Else
Set oRequest = Test.CreateRequest
oRequest.Path = "/emobile/l.cfm"
oRequest.Verb = "POST"
oRequest.HTTPVersion = "HTTP/1.0"
oRequest.EncodeBody = False
set oHeaders = oRequest.Headers
oHeaders.RemoveAll
oHeaders.Add "Accept", "image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, */*"
oHeaders.Add "Referer", "http://" & sSiteName &
"/emobile/cr.cfm"
oHeaders.Add "Accept-Language", "en-us"
oHeaders.Add "Content-Type",
"application/x-www-form-urlencoded"
oHeaders.Add "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR
2.0.50215)"
'oHeaders.Add "Host", sSiteName
oHeaders.Add "Host", "(automatic)"
oHeaders.Add "Pragma", "no-cache"
oHeaders.Add "Cookie", "(automatic)"
oHeaders.Add "Content-Length", "(automatic)"
' Test.TraceLevel= -1
oRequest.Body = "rand=8833&p_type=" & GetRandomPropertyType &
"mystatus=" & GetRandomStatus & "area=" & GetRandomArea &
"st=&streetnu"
oRequest.Body = oRequest.Body + "m1=&streetnum2=&zip_code=&lp1=" &
GetRandomPrice1 & "lp2=" & GetRandomPrice2 & "br1=" & GetRandomBed1
oRequest.Body = oRequest.Body + "br2="& GetRandomBed2& "ba1=" &
GetRandomBath1 & "ba2=" & GetRandomBath2 &
"sf1=&sf2=&lsz1=&lsz2=&unt1=&unt2"
oRequest.Body = oRequest.Body + "=&sd=0&Search=Search"
Set oResponse = oConnection.Send(oRequest)
If (oResponse is Nothing) Then
Test.Trace "Error: Failed to receive response for URL to "
+ "/emobile/l.cfm"
Else
strStatusCode = oResponse.ResultCode
End If
oConnection.Close
End If
End Sub
'---------------------
' here I am trying to parse the oResponse.body but get
' nothing using the InStr towards the end of the Sub. I also tried
' the code on the sub above right after the If (oResponse Nothing)
' Then
Else
'Begin params parsing

Sub SendRequest10()
Dim oConnection, oRequest, oResponse, oHeaders, strStatusCode
Dim oUser, Pos1, Pos2, sParams
If fEnableDelays = True then Test.Sleep (287)
Set oConnection = Test.CreateConnection(sSiteName, 80, false)
If (oConnection is Nothing) Then
Test.Trace "Error: Unable to create connection to " & sSiteName
Else
Set oRequest = Test.CreateRequest
Set oUser = Test.GetCurrentUser
oRequest.Path = "/emobile/l.cfm"
oRequest.Verb = "GET"
oRequest.HTTPVersion = "HTTP/1.0"
set oHeaders = oRequest.Headers
oHeaders.RemoveAll
oHeaders.Add "Accept", "*/*"
'Test.Trace("**************************" & oUser.Name & "
RETRIEVING RESULTS**************************")
oHeaders.Add "Referer", "http://" & sSiteName &
"/emobile/l.cfm"
oHeaders.Add "Accept-Language", "en-us"
oHeaders.Add "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR
2.0.50215)"
'oHeaders.Add "Host", sSiteName
oHeaders.Add "Host", "(automatic)"
oHeaders.Add "Cookie", "(automatic)"
Set oResponse = oConnection.Send(oRequest)
If (oResponse is Nothing) Then
Test.Trace "Error: Failed to receive response for URL to "
+ "/CFIDE/debug/images/topdoc.gif"
Else
'Begin params parsing
If InStr(oResponse.Body, "params") Then
Pos1 = InStr(InStr(oResponse.Body, "params"), oResponse.Body,
"value=")
Pos2 = InStr(Pos1, oResponse.Body, "/>")
sParams = Mid(oResponse.Body, Pos1, Pos2)
Test.Trace "params 2= " & sParams
End If
strStatusCode = oResponse.ResultCode
'Test.Trace "params = " & sParams
End If
oConnection.Close
End If
End Sub

Aug 31 '05 #1
0 2090

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: 50295 | last post by:
Hi! I'm trying to set the align property/attribute of an IFrame to center but its not working (see below). Can anyone please tell me what's going on, and if there's a work around for this? ...
2
by: Anthony Abbot | last post by:
Hi I have a requirement to use the Application Center Test (part of Visual Studio.Net Enterprise architect) program, to simulate loading on my Web servers. Does anyone know if it is any good? I...
0
by: benh | last post by:
Does anyone have any insight into how Application Center Test handles binary data in a response body? My problem: I need some specific data from inside a PDF file that is coming down as the...
0
by: cpavon | last post by:
Hello everyone, I am fairly new to MACT, I am currently trying to parse the oResponse.Body to retrive a dynamic values...store in an array and then randomly post those values. Does anyone...
9
by: AA | last post by:
This is making me crazy!! Please, if some body can help me. I'm testing a ver simple socket client. In my test I just open and close a connection (in a loop) to my local IIS server (port 80)...
3
by: sokolo | last post by:
Hello, I wrote a windows service application however it is not working. The service is supposed to enter a new task every 5 sec within Microsoft Outlook. Here is the code for application: ...
1
by: mudasserrafiq | last post by:
I am using following asp file default.asp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <META http-equiv=Content-Type content="text/html; charset=windows-1252"> <META content="0...
0
by: SilentCodingOne | last post by:
I'm creating an application that allows the user to create, edit and begin to post ads to Craiglist. I have everything but the begin to post the ad portion complete and cannot seem to get it to work....
1
by: morrisqueto | last post by:
Hello, One of my websites just started sending a new rare error. The site has been working for almost 2 years without trouble, but today morning started giving away this error in all my views. ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.