PDA

View Full Version : Can't find web forms on IE Object



davidleite
05-06-2010, 04:39 PM
Hello everybody!

I'm trying to fill in some textboxes on a website, using the InternetExplorer object. This should be as simple as accessing the form with MyIEobject.document.all("formname").etc ... But I don't know what happened, cause no forms show up at all.
So I found out the website is designed with frames. Then I go ahead and try to access the frames, and then the forms, with no charm. And it turns out that my IE object has really a lot of elements, which made me spend about 5 hours trying to look for the forms, and nothing.
The conclusion is, I have about 10 fields inside the "content" frame, and I can't find them anywhere inside the IE object. The same also happens to the links on the menu...
Is there anyway they could be blocking DHTML to actually see the forms or something?

Here's the code I'm using:

Dim objShell As Shell
Dim objIE As InternetExplorer
Dim objExplorer As ShellFolderView
Dim obj As Object
Set objShell = New Shell
For Each obj In objShell.Windows
If TypeName(obj.Document) = "HTMLDocument" Then
Set objIE = obj
End If
Next obj

I'm just using it to grab the IE object, which is actually already open.

Anyone sees a solution?

Thanks in advance!

davidleite
05-07-2010, 11:26 AM
Still every solution I find for this problem is to go into the FORM object collection somewhere, and change what I want.

But all the form objects I have are totally empty!

Where are my 10 little missing forms?

Any help will be greatly appreciated!

davidleite
05-07-2010, 11:34 AM
It seems I can't access the objects inside the frames form some reason, as if they were encapsulated... None of the "A", "TD", "OPTION", "FORM", or any other tags are visible.

Here is the code of the page, with the framesets.



<HTML>
<HEAD>
<TITLE>Title of the page</TITLE>
</HEAD>
<frameset rows="80,*" border="0" frameborder=no framespacing=no scrollleft=0 scrolltop=0>
<frame name="menu" src="Menu.asp" border="0" scrolling="no" noresize frameborder=no framespacing=no height=80 marginheight=0 marginwidth=0 scrollleft=0 scrolltop=0>
<frame name="conteudo" src="Default.asp" border="0" scrollleft=0 marginwidth=0 marginheight=0 framespacing=no frameborder=no>
</frameset>
</HTML>

Shred Dude
05-09-2010, 09:35 PM
You might need to get down to the forms collection within the FrameElement's document object. Something like:

objie.document.frames(1).document.forms(1).getelementbyid(MYFORMELEMENTNAME HERE).value = "What I want to put in the form"

davidleite
05-10-2010, 10:04 AM
You might need to get down to the forms collection within the FrameElement's document object. Something like:

objie.document.frames(1).document.forms(1).getelementbyid(MYFORMELEMENTNAME HERE).value = "What I want to put in the form"

I can't find it! Every "forms" element have length = 0 ! =/

davidleite
05-10-2010, 10:35 AM
Well, I just tried objIE.Document.frames(1).document.all("IdOfMyField").Value, and that worked! It changed the value on it.

Then I found out it only worked because my log in session was already EXPIRED.

When I logged back in, and tried the same code, I got an "ACCESS DENIED" error. When trying to access the HTMLElement "document" inside objIE.Document.frames(1) , or objIE.Document.frames(0) for that matter...

Any other way to get those fields filled up now the access is denied?

Is SendKeys really the only option?

stanl
05-19-2010, 03:43 AM
You wrote that the URL is already running. Is that really your only option. I fill out forms on pages with frames by logging into the main url, then navigating directly to the frame. For example suppose

url = https:\\mysite.com\index.html

which has three frames one of them being form.asp

I would then re-navigate as

url = https:\\mysite.com\form.asp - which preserves any sessionid if the main url required credentials. I then fill in the form fields on that page and submit w/out problems. .02 Stan