473,581 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Microsoft application center test...oRespons e.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;392 8;P_TYPE;0;MYST ATUS;5;AREA;2;S D;0;SEARCH;Sear ch;"/>

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.CreateConn ection(sSiteNam e, 80, false)
If (oConnection is Nothing) Then
Test.Trace "Error: Unable to create connection to " & sSiteName
Else
Set oRequest = Test.CreateRequ est
oRequest.Path = "/emobile/l.cfm"
oRequest.Verb = "POST"
oRequest.HTTPVe rsion = "HTTP/1.0"
oRequest.Encode Body = False
set oHeaders = oRequest.Header s
oHeaders.Remove All
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",
"applicatio n/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_ty pe=" & GetRandomProper tyType &
"mystatus=" & GetRandomStatus & "area=" & GetRandomArea &
"st=&street nu"
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=&u nt2"
oRequest.Body = oRequest.Body + "=&sd=0&Search= Search"
Set oResponse = oConnection.Sen d(oRequest)
If (oResponse is Nothing) Then
Test.Trace "Error: Failed to receive response for URL to "
+ "/emobile/l.cfm"
Else
strStatusCode = oResponse.Resul tCode
End If
oConnection.Clo se
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.CreateConn ection(sSiteNam e, 80, false)
If (oConnection is Nothing) Then
Test.Trace "Error: Unable to create connection to " & sSiteName
Else
Set oRequest = Test.CreateRequ est
Set oUser = Test.GetCurrent User
oRequest.Path = "/emobile/l.cfm"
oRequest.Verb = "GET"
oRequest.HTTPVe rsion = "HTTP/1.0"
set oHeaders = oRequest.Header s
oHeaders.Remove All
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.Sen d(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(oRe sponse.Body, "params"), oResponse.Body,
"value=")
Pos2 = InStr(Pos1, oResponse.Body, "/>")
sParams = Mid(oResponse.B ody, Pos1, Pos2)
Test.Trace "params 2= " & sParams
End If
strStatusCode = oResponse.Resul tCode
'Test.Trace "params = " & sParams
End If
oConnection.Clo se
End If
End Sub

Aug 31 '05 #1
0 2135

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

Similar topics

1
5537
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? Thanks, - Olumide
2
2787
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 have gotten it to work and it seems to do the job. I have a requirement to run multiple tests from many computers simultaneously. The manual...
0
1256
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 response body. The response contains binary data mixed with plain text which is where my data lies. Unfortunately, when I print the response body to...
0
421
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 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.
9
11328
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) using System.Net.Sockets;
3
5863
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: public partial class CheckAccountsService : ServiceBase {
1
3876
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 Days" name=revisit-after> <META content=info@siderinternational.com name=email> <META content="Omer Safdar" name=author> <META...
0
833
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. I basically want it to send the data the user has put into the ad so that the user does not need to do anything until they get to the 2nd page of the...
1
3802
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. Microsoft VBScript runtime error '800a01fb' An exception occurred: 'MoveNext' /test.asp, line 544 Here is the code:
0
7862
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7789
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8144
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8301
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6551
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5670
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1400
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.