[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:
webbrowser1.document.getElementbyName('"txtBox").item(0).some method?
if you know get back to me :wave:
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:
webbrowser1.document.getElementbyName('"txtBox").item(0).some method?
if you know get back to me :wave:
you can trap the error can't u?
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.
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:
Dim contained As Boolean
contained =
wb.Document.body.contains(wb.Document.getElementsByName("txtInput").Item(0))
If contained Then wb.Document.getElementsByName("txtInput").Item(0).Value = text
:D