Navigate IE using VBA: trouble with submit form

codactu

New member
Local time
Today, 02:39
Joined
May 5, 2010
Messages
6
Hello,
I m a new user and I have a trouble with a submitting form .
The link of the web site is http://www.assurland.com/Pages/Resul...OPEOEXIEAHHGDD

and i cannot submit the form "Cliquez ici pour comparer en détail".
Here is my code:

For Num = 0 To IE.Document.getElementsByTagName("TD").Length - 1
If IE.Document.getElementsByTagName("TD").Item(Num).className = "al_compare" Then

IE.Document.getElementsByTagName("TD").Item(Num).Click

'MsgBox IE.Document.getElementsByTagName("TD").Item(Num).tagName
'MsgBox IE.Document.getElementsByTagName("*").Item(Num).innerText
Exit For
End If
Next

It isn't work.
Can anybody give an advice.
Codactu,

The code source of the submit form is:
<td class="al_compare" colspan="10"><div onclick="horizontalCompare('EMPR');" onmouseover="javascript:proposalBubble_on('Cochez au maximum 5 assureurs');" onmouseout="javascript:proposalBubble_off();">Cliquez ici pour comparer en détail</div></td>
 
first of all, i don't read french (or whatever language this is), but you're trying to click a div. can't do that. you also can't click a table cell, which is identified by the tag "TD". try submitting the form instead. the code in source to look at is :
PHP:
<form name="aspnetForm" method="post" action="/Pages/Resultat/Restit.aspx?
wait=1&crm=1&product=EMPR&qid=BTKOPEOEXIEAHHGDD" id="aspnetForm">

might always want to look at the code you posted here. there are errors in it, for instance, a space in the word CLICK on one of the lines.

submit the form like this:
PHP:
ie.document.forms(0).submit

another thing, say what doesn't work. don't just say "it doesn't work".
 
ok,
About the spaces in the code i posted, it's happen when i pasted it.

I tried the code "ie.document.forms(0).submit " . It's effect is to uncheck the chexboxes which are on the page.

If i can't click on a div, is it possible to move the cursor of the mouse on and to click ?

Sorry for mistakes, i'm not a native speaker (i just try to make me understand)
 
Hi,
About the spaces in my code it's happen when i pasted it.
I have tried to submit the form with "ie.document.forms(0).submit" but it's effect is to uncheck the checkboxes.
If i can't click on a div, is it possible to move the cursor of the mouse to the form and click ?

Sorry for the mistakes, i'm not a native speaker in english
Thank you
 
i'm not sure man. the same thing happens to me. you have to somehow find out how to click the div. clicking the table cell i'm 99% sure WON'T work. this is as close as I came to finding the answer: http://msdn.microsoft.com/en-us/library/ms536460(v=VS.85).aspx

that page hints that you can use this code:
PHP:
ie.Document.getElementsByTagName("div").Item(15).tagname

to get the tag name of the specific DIV on the page with the index value of 15 (this is the DIV you are looking at). I don't have time to search google to find the subproperties of the property called ITEM of the DOM. But, if you can find a subproperty that can give you either the NAME or the ID of the div element, I'm sure you can add ".CLICK" to the end of the code line and make it work. I can tell you now that "ID" does not work. already tried it and VBA errors out.

also, you cannot simply use the URL of the page that comes after the form submission because they are using a database and submission ID's to identify webpage activity, like this forum does with the online databases and search ID's in the query string when you run a forum search.

good luck man
 
Good!!!!

Thank you very much. It works now
The code is:
PHP:
 IE.Document.getElementsByTagName("div").Item(15).Click

Have a good day ,


Codactu.
 

Users who are viewing this thread

Back
Top Bottom