Consulting

Results 1 to 7 of 7

Thread: Can't find web forms on IE Object

  1. #1

    Can't find web forms on IE Object

    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:

    [vba]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[/vba]

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

    Anyone sees a solution?

    Thanks in advance!

  2. #2
    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!

  3. #3
    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 Code:
    <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>

  4. #4

    Frames

    You might need to get down to the forms collection within the FrameElement's document object. Something like:

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

  5. #5
    Quote Originally Posted by Shred Dude
    You might need to get down to the forms collection within the FrameElement's document object. Something like:

    [vba]objie.document.frames(1).document.forms(1).getelementbyid(MYFORMELEMENTNAME HERE).value = "What I want to put in the form"[/vba]
    I can't find it! Every "forms" element have length = 0 ! =/

  6. #6
    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?

  7. #7
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •