Results 1 to 4 of 4

Thread: [RESOLVED]need to check weather or not a web element is present

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    86

    Resolved [RESOLVED]need to check weather or not a web element is present

    heres the problem, I made a program the inputs to a website's text box. sometimes though, the box isnt on the page and I get an error message so I need to check weather or not the input box is there or not. or can I say:

    VB Code:
    1. webbrowser1.document.getElementbyName('"txtBox").item(0).some method?
    if you know get back to me
    Last edited by Aries Mars; May 11th, 2005 at 05:55 AM.

  2. #2
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011

    Re: need to check weather or not a web element is present

    Quote Originally Posted by Aries Mars
    heres the problem, I made a program the inputs to a website's text box. sometimes though, the box isnt on the page and I get an error message so I need to check weather or not the input box is there or not. or can I say:

    VB Code:
    1. webbrowser1.document.getElementbyName('"txtBox").item(0).some method?
    if you know get back to me
    you can trap the error can't u?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    86

    Question Re: need to check weather or not a web element is present

    yes I could but then I found a method contained in :
    this.document.body.contains(oElement) in the html DOM
    here

    but I cant seem to get it to work. They say in the site that the webbrowser control has access to the whole html DOM so this should work but it doesnt. I get a Type Mismatch error.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    86

    Resolved Re: need to check weather or not a web element is present [RESOLVED]

    While I was typing my reply to -Moinkhan- this syntax tried before hand, worked.

    VB Code:
    1. Dim contained As Boolean
    2. contained =
    3. wb.Document.body.contains(wb.Document.getElementsByName("txtInput").Item(0))
    4.  
    5. If contained Then wb.Document.getElementsByName("txtInput").Item(0).Value = text




Posting Permissions

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



Click Here to Expand Forum to Full Width