Link to home
Start Free TrialLog in
Avatar of jwhiteman1967
jwhiteman1967

asked on

How do I find the password in an <input> tag?

In need to be able to tell which <input> tags have the 'password' type.

ex:
<input type="password" name="password" size="12">

Here is what  I have, but I have something wrong...

                    Dim htmlCollection As HtmlElementCollection = WebBrowser.Document.GetElementsByTagName("INPUT")
                    For Each elem As HtmlElement In htmlCollection
                        Dim ElemName As String
                        ElemName = elem.GetAttribute("password")
                        'elem.SetAttribute("password", Trim(strPassword))
                        'MessageBox.Show(elem.TagName, elem.)
                        If elem.GetAttribute("password") = "" Then
                            WebBrowser.Document.All(elem.Name).InnerText = Trim(strPassword)
                            bPassword = True
                            Exit For
                        End If
                    Next

Thanks!
Avatar of Dxpert
Dxpert
Flag of United States of America image

Why are you complicating it like that?
Why can't you just make that password input, runat="server"?


ex:

'aspx
<input type="password" id="password" size="12" runat="server">



'aspx.vb
password.value = Trim(strPassword)
try
m.GetAttribute("Type")
ASKER CERTIFIED SOLUTION
Avatar of PaulHews
PaulHews
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial