?
Solved

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

Posted on 2007-11-21
3
Medium Priority
?
228 Views
Last Modified: 2010-04-23
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!
0
Comment
Question by:jwhiteman1967
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Expert Comment

by:Dxpert
ID: 20329232
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)
0
 
LVL 21

Expert Comment

by:surajguptha
ID: 20329245
try
m.GetAttribute("Type")
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 2000 total points
ID: 20329263
Try this:

Dim htmlCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("INPUT")
For Each elem As HtmlElement In htmlCollection
    Dim InputType As String = elem.GetAttribute("type")
    If InputType.ToLower = "password" Then
        elem.InnerText = strPassword
        bPassword = True
        Exit For
    End If
Next
0

Featured Post

A new era in Cloud training has arrived.

A day that will go down in Cloud history.. But are you ready for it? Will you accept this Cloud challenge?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question