473,473 Members | 1,576 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Make a click on a javascript link in an ASP page

Hello,

My name is Juan. I am new to the forum.
Here I leave you a problem to see if you can help me.

General Description

I am developing an application in Visual Basic 6.
The program has to consult an ASP page of a public argentinian service
called ANSES, obtain a result from the response (the query is done by
completing a form).
The program sends the query with an Internet Transfer Control and the POST
method supported.
Up to here, all goes Ok.

The problem is that sometimes, the query result may not finish in the result
page, but the ASP server can respond as result a page with links. And
clicking on those links makes appear the final desired result.

So, my program detects if the response is effectively the final query result
or a link form to click inside. This does it Ok.

The problem is that I do not know to simulate a click on a corresponding
form link with Visual Basic code, or simulate the submit method from that
control with POST.
I have tried with many entry data but no way.

Details

Data form filling page:
http://www.anses.gov.ar/expedientes.htm

ASP page:
http://www.anses.gov.ar/servicios/IGTPC/Consulta.aspx
Visual Basic code to automate the query response:
Private Sub Command4_Click()
Dim str As String
Dim data As String
Dim bData() As Byte
Dim num As Long
Dim j As Long
Dim count As Long

'completa los datos del formulario de expedientes
data = "txtDoc=6903892&" & _
"TipoTramite=1&" & _
"submit1=Consultar"

Inet1.Execute "http://www.anses.gov.ar/servicios/IGTPC/Consulta.aspx",
"POST", data, "Content-Type: application/x-www-form-urlencoded"
'bucle que espera que el control inet este listo
Do While Ready1 = False
DoEvents
Loop
Ready1 = False

str = Inet1.GetChunk(100000, icString)
'salvo la página de links. El documento que puse en txtDoc devuelve
varios resultados en una pagina de links.
num = FreeFile
Open "f:\cuil\exp-multi.htm" For Output As num
Print #num, str
Close num

If InStr(1, str, "Para seleccionar un expediente, realice un doble
click") <> 0 Then
'Mas de 1 expediente
'javascript:__doPostBack('DGExp$_ctl2$_ctl0','')

j = 2
count = 0

Do While True
If InStr(1, str, "javascript:__doPostBack('DGExp$_ctl" & CStr(j)
& "$_ctl0','')") <> 0 Then
count = count + 1
j = j + 1
Else
'no hay mas
Exit Do
End If
Loop

Inet3 = Inet1

For j = 2 To count + 1
'str =
Inet1.OpenURL("javascript%3A%5F%5FdoPostBack%28%27 DGExp%24%5Fctl" & CStr(j)
& "%24%5Fctl0%27%2C%27%27%29")
Inet1.Execute , "POST", "%5F%5FEVENTTARGET=DGExp%3A%5Fctl" &
CStr(j) & "%3A%5Fctl0&%5F%5FEVENTARGUMENT=%00", "Content-Type:
application/x-www-form-urlencoded"

Do While Ready1 = False
DoEvents
Loop
Ready1 = False

str = Inet1.GetChunk(100000, icString)
num = FreeFile
Open "f:\cuil\exp-multi" & CStr(j - 1) & ".htm" For Output As
num
Print #num, str
Close num

Inet1 = Inet3
Next

MsgBox "Ok. " & CStr(count) & " expedientes procesados."

Else
'1 expediente
num = FreeFile
Open "f:\cuil\exp.htm" For Output As num
Print #num, str
Close num
WebBrowser1.Visible = True
WebBrowser1.Silent = True
WebBrowser1.navigate "f:\cuil\exp.htm"

Do While WebBrowser1.Busy = True
DoEvents
Loop
Do While WebBrowser1.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
WebBrowser1.document.Charset = "UTF-8"
WebBrowser1.Refresh

MsgBox "Ok"
End If

End Sub

Well, the thing is that the problem as I said results in clicking the links
that has the "URL" javascript:__doPostBack('DGExp$_ctl2$_ctl0','')
I have tested a lot of things, changing arguments, but is does not work (it
returns me the page WITHOUT the result data).
Apparently it does not submit the data as it has to.

Of course I will thank your answers very very much.

With attention,
Juan

Aug 22 '05 #1
0 3389

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

Similar topics

4
by: KS | last post by:
Im trying to prevent the user from clicking any other links on my page when the user have selected/clicked a href once. Sometimes it takes a while before the next page loads so some user will try...
1
by: ajay | last post by:
I have following code for a slide menu but i twiked it to work for a single level menu. Open it in a Browser to get a clear picture. I have 2 Qs 1) How to make first entry as non-link. i.e i...
5
by: lawrence | last post by:
Here is a script that is suppose to turn the DIV tag "optionalDiv" visible on click. This works fine on a PC (IE and Netscape both I think) but not on a Mac. Why? <script...
21
by: news.btinternnet.com | last post by:
I can do this in IE myLink.click(); //Invoking the handler as if the user had clicked on the link themselves. I need to be able to do the same in Netscape Navigator, can anyone help ?
3
by: Sameer | last post by:
I have a webpage that has a link button. This link button on click opens up a new page. This is what is happening: 1. Load the web page. 2. Click on the link. 3. Refresh the web-page. Result:...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
11
by: yangsuli | last post by:
i want to creat a link when somebody click the link the php script calls a function,then display itself :) i have tried <a href=<? funtion(); echo=$_server ?>text</a> but it will call the...
9
by: GloStix | last post by:
Okay, when I click the link it dissapears and makes a white space underneath it but the space is clickable. so when you click the space, the link actually works Used Firefox 3.0 RC2 for this. OS X...
1
by: jntmac | last post by:
I cannot find the answer anywhere on the entire net: I have an image on my website. The image shows a newsletter, and the image says "Click here to register to receive our newsletter". I know...
0
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,...
0
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...
0
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...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
1
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...
0
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 ...
0
muto222
php
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.