locked
Document.GetElementById in .NET Compact Framework RRS feed

  • Question

  • hi everyone, I am trying to write a program in WINCE using Visual Studio 2005 (VB.NET)

    it's like a login page for user to login to yahoo(for example).

     

    WebBrowser1.Navigate("http://login.yahoo.com/")
    
    WebBrowser1.Document.GetElementById("login").SetAttribute("value", TextBox1.Text)
    WebBrowser1.Document.GetElementById("passwd").SetAttribute("value", TextBox2.Text)
    WebBrowser1.Document.GetElementById(".save").InvokeMember("click")
    

    But I find that the webbrowser.Document is not supported by .NET Compact Framework.

     

    Is there any other way to preform this kinda function in smart device?

    Thanks :)

     

    Tuesday, November 29, 2011 8:33 AM

Answers

  • AFAIK no.
    This posting is provided "AS IS" with no warranties, and confers no rights.
    • Proposed as answer by Jesse Jiang Thursday, December 1, 2011 3:45 AM
    • Marked as answer by Jesse Jiang Tuesday, December 6, 2011 6:59 AM
    Tuesday, November 29, 2011 5:17 PM
  • thanks elie el alam, but "Document" is not working with .NET Compact Framework :(
    • Marked as answer by Jesse Jiang Tuesday, December 6, 2011 6:59 AM
    Wednesday, November 30, 2011 1:00 AM

All replies

  • hi everyone, I am trying to write a program in WINCE using Visual Studio 2005

    it's like a login page for user to login to yahoo(for example).

     

    WebBrowser1.Navigate("http://login.yahoo.com/")
    
    WebBrowser1.Document.GetElementById("login").SetAttribute("value", TextBox1.Text)
    WebBrowser1.Document.GetElementById("passwd").SetAttribute("value", TextBox2.Text)
    WebBrowser1.Document.GetElementById(".save").InvokeMember("click")
    

    But I find that the webbrowser.Document is not supported by .NET Compact Framework.

     

    Is there any other way to preform this kinda function in smart device?

    Thanks :)

     


    • Edited by vichk Tuesday, November 29, 2011 6:30 AM
    • Merged by Kee Poppy Thursday, December 1, 2011 5:50 AM duplicate thread
    Tuesday, November 29, 2011 6:29 AM
  • Probably you have a better chance for a reply in a CE framework forum. 

    You can test yourself what the AXWebbrowser (the Com version of the Webbrowser) will do for you.

    Take a look at this message from Martin

    http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/1d7f9f89-4d30-400a-a482-017544cb0776/

    Be aware that it is the SHDocVB.dll, the part which is standard in all newer Windows OS systems to do the IE and Explorer work.

     


    Success
    Cor
    Tuesday, November 29, 2011 6:52 AM
  • thanks man :)

    I'll try

    Tuesday, November 29, 2011 8:33 AM
  • AFAIK no.
    This posting is provided "AS IS" with no warranties, and confers no rights.
    • Proposed as answer by Jesse Jiang Thursday, December 1, 2011 3:45 AM
    • Marked as answer by Jesse Jiang Tuesday, December 6, 2011 6:59 AM
    Tuesday, November 29, 2011 5:17 PM
  •  to login to yahoo(for example)

     


    Hi Vichk,

    The following example is about automatic login to yahoo

    Code:

    Public Class Form1
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            WebBrowser1.Navigate("https://login.yahoo.com/config/login?")
        End Sub
    
        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    
            Dim theElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
            For Each curElement As HtmlElement In theElementCollection
                Dim controlName As String = curElement.GetAttribute("id").ToString
                If controlName = "username" Then
                    curElement.SetAttribute("Value", "huiodd@yahoo.com") ' here you put your yahoo email
                End If
            Next
    
           
    
            theElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
            For Each curElement As HtmlElement In theElementCollection
                Dim controlName As String = curElement.GetAttribute("id").ToString
                If controlName = "passwd" Then
                    curElement.SetAttribute("Value", "71652392")  'password
                End If
            Next
    
            theElementCollection = WebBrowser1.Document.GetElementsByTagName("button")
            For Each curElement As HtmlElement In theElementCollection
                Dim controlName As String = curElement.GetAttribute("id").ToString
                If controlName = ".save" Then
                    curElement.InvokeMember("click")
                End If
    
    
            Next
        End Sub
    End Class
    


     

    Wednesday, November 30, 2011 12:37 AM
  • thanks elie el alam, but "Document" is not working with .NET Compact Framework :(
    • Marked as answer by Jesse Jiang Tuesday, December 6, 2011 6:59 AM
    Wednesday, November 30, 2011 1:00 AM
  • Hi vichk,

    I noticed you have posted this in Smart Device forum as well. I am going to merge it to keep them in one thread.

    Thanks,


    Kee Poppy [MSFT]
    MSDN Community Support | Feedback to us
    Thursday, December 1, 2011 5:49 AM