Page 14 of 14 FirstFirst ... 411121314
Results 521 to 531 of 531

Thread: Manipulate/Change/Form Fill data in webpages using the Webbrowser control

  1. #521
    Member
    Join Date
    Aug 2006
    Posts
    57

    Exclamation Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control

    i get the picture on website, then i need my application auto text values of the picture...
    can u help me with this problem??

    this my code for get the image:
    Code:
            Dim doc As IHTMLDocument2 = WebBrowser1.Document.DomDocument
            Dim imgRange As IHTMLControlRange = CType(doc.body, HTMLBody).createControlRange
            For Each img As IHTMLImgElement In doc.images
                If img.GetAttribute("src").ToString.Contains("image.php") Then
                    imgRange.add(img)
                    imgRange.execCommand("Copy", False, Nothing)
                    PictureBox1.Image = Clipboard.GetDataObject.GetData(DataFormats.Bitmap)
                    Exit For
                End If
            Next


    My Problen on Thread
    http://www.vbforums.com/showthread.p...54#post4111754

  2. #522
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control

    @afdoal you need to use a decaptcha service or delve into image processing (OCR)

    Can anyone help on how to simulate typing, which is a combination of onkeydown, onkeypress and onkeyup events?

    regards
    Programming is all about good logic. Spend more time here


    (Generate pronounceable password) (Generate random number c#) (Filter array with another array)

  3. #523
    New Member
    Join Date
    Jun 2012
    Posts
    1

    Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control

    @kleinma:
    I have some trouble determining the completed event.

    Code:
    ' Load the url
        Private Sub frmTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim orgurl As String = "url"
            wb.Navigate(orgurl)
        End Sub
    
    'Document completed event
        Private Sub webBrowser_DocumentCompleted(sender As Object, e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles wb.DocumentComplete
    'Change the value in the txt box, and submit  
       
    DirectCast(GetCurrentWebDoc.getElementById("ctl00_mainContent_Live3Price1_NEW_wdcDate_dateInput_TextBox"), mshtml.HTMLInputElement).value = "22/06/2012"
            DirectCast(GetCurrentWebDoc.getElementById("ctl00_mainContent_Live3Price1_NEW_Button1"), mshtml.HTMLInputElement).click()
    'AFTER submit, content will be loaded. The submit button call AJAX to load data into table. Url unchanged.
    'But the ready state already be "Complete"
    'I'v tried WebBrowserReadyState.Complete and SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE , but get the same result, their state will be "Complete", even when browser still loading the content.
            If wb.ReadyState = WebBrowserReadyState.Complete Then
                MessageBox.Show("Done")
            End If
        End Sub
    How to check if browser has completely loaded (after AJAX)?

    I have to parse the source code (after AJAX), and need to check the state of browser

  4. #524
    New Member
    Join Date
    Jul 2012
    Posts
    3

    Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control

    Hi all ,

    can any one help me with this :

    a program takes value from txt document and fills it in to online registration form. so i dont need it to do in manualy over and over again . I just change the txt file every time i need to create new .

    lets say . "mr bob brown". have to be filled in to online registration form . lets say register.jabber.org.
    so i just need to pres button "register" on a webpage . or better the program to have a button too after fill execute (but offcourse it will be hard to avoid the HUMAN CHECK box ) but still i need help in this I dont need passing by check box . i need to auto fill . "roboform" similer to this but simpler .

  5. #525
    New Member
    Join Date
    Aug 2012
    Posts
    1

    Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control

    I need help filling out the region and the category this web page. http://www.inetgiant.com/item/new It wants you to physically click it. I got everything else i need to work. Please help.

  6. #526
    Hyperactive Member ibennz's Avatar
    Join Date
    Aug 2010
    Posts
    282

    Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control

    Was wondering if you updated this to 2005 browser. I use default webbrowser (extended) that I found on some scratch code. Its actually 2005 IE. It doesn't want to convert my html source to mshtml .
    Code:
         Try
             
                Dim GetCurrentWebDoc As mshtml.HTMLDocument = DirectCast(wb.Document, mshtml.HTMLDocument)
                Dim MyDiv As mshtml.HTMLDivElement = DirectCast(GetCurrentWebDoc.getElementsByTagName("img"), mshtml.HTMLDivElement)
                If MyDiv.getAttribute("className") = "vam hand" Then
                    MessageBox.Show(MyDiv.getAttribute("onclick"))
    
                End If
    
            Catch
                MsgBox(ErrorToString, MsgBoxStyle.Critical)
            End Try

  7. #527
    New Member
    Join Date
    May 2011
    Posts
    7

    Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control

    SOLVED
    VS 2010 converts automaticly.


    Quote Originally Posted by kleinma View Post
    All the time I see people asking how to autofill in forms on webpages or how to click a button in a webpage that is hosted in the webbrowser control, via VB code.

    It is really not all that difficult, once you get around the casting of types to the correct kind when using the COM reference.

    This example project highlights the following manipulations (as well as opening the door to manipulate just about anything on a webpage that is possible)

    * Getting a value of an HTML input element
    * Setting a value of a HTML input element
    * Getting a value of an HTML text area
    * Setting a value of a HTML text area
    * Set HTML radio buttons selected or not
    * Click an HTML button
    * Submit an HTML Form
    * Get the sources for all images in HTML document
    * Get and display all the links in the HTML document
    * Alter non form elements (like changing the color of a DIV tag)
    * Getting values from an HTML Select element (value and selected index)
    * Display page HTML source
    * Run a javascript that is in the HTML Page
    * click a checkbox in an HTML form
    * Print the current page (with printer selection dialog)
    * Added 8/24/2006 - Highlight webpage text via code

    This specific example code is done using

    Visual Studio 2005 (VB.NET)
    However I use the COM WB Control, not the built in .NET 2.0 WB Control (because its functionality is rather limited)
    I also use a reference to the MSHTML scripting engine, which is what allows you to parse a webpage into all its elements so you can manipulate them.


    Please let me know if you have any questions/comments/suggestions.

    I can add more functionality examples if someone can think of one....
    Hello

    This looks to be exactly what i need to start on a tool at the company i work for, do you have it on VB 2010? i am having dificulties to open it.
    Any idea how to solv this?

    Thank you any way, im sure i´ll find a way to make it work.
    Best regards.
    Blitz
    Last edited by BlitzMX; May 17th, 2013 at 10:50 AM. Reason: SOLVED

  8. #528
    New Member
    Join Date
    Dec 2013
    Posts
    1

    Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control

    The project page "TestPage.htm" shows signs of a budding star in web design. Some real layout talent there.

    On a more serious note, I'm sure I speak for many when I say thank you. Your post is well written and it has obviously helped many of us who still have a lot to learn. I've used your code as a starting point on more than one project. Again, thank you kleinma.

  9. #529
    Banned
    Join Date
    May 2014
    Location
    Krzyzaken
    Posts
    4

    Nice

    Nice

  10. #530
    Hyperactive Member
    Join Date
    Jul 2011
    Posts
    294

    Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control

    I need to fill this text area but the value of class and ID changes:

    <div aria-labelledby="255" role="textbox" g_editable="true" class="df b-K b-K-Xb URaP8 editable" id=":78.f" contenteditable="true"></div>

    How can I have success ?

  11. #531
    Registered User
    Join Date
    Oct 2014
    Posts
    2

    Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control

    Dear every predecessors,

    This is a super helpful thread. I am not sure if anyone still following the thread, I hope there is a little chance somebody could help

    Right now, I am trying to fill forms on website, I did it with "Sendkeys", but by reading #196, it is not appropriate.

    Code:
            
            WebBrowser1.Navigate("https://mybank.icbc.com.cn/icbc/enperbank/index.jsp")
            WaitForPageLoad()
            TextBox1.Text = WebBrowser1.Url.ToString
    
            SendKeys.Send("UserABC")
            SendKeys.Send("{TAB}")
            SendKeys.Send("Password")
    Code:
        Private Property pageready As Boolean = False
    
    #Region "Page Loading Functions"
        Private Sub WaitForPageLoad()
            AddHandler WebBrowser1.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf PageWaiter)
            While Not pageready
                Application.DoEvents()
            End While
            pageready = False
        End Sub
    
        Private Sub PageWaiter(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs)
            If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
                pageready = True
                RemoveHandler WebBrowser1.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf PageWaiter)
            End If
        End Sub
    
    #End Region
    I believe that the login form is an ActiveX control ttps://mybank.icbc.com.cn/icbc/enperbank/index.jsp
    The source code of the password field:
    Code:
    <OBJECT onkeyup="getfocus1('KeyPart', event);detectCapsLock('logonform','safeEdit1',500,300,400,'logontb');" onfocus="detectCapsLock('logonform','safeEdit1',500,300,400,'logontb')" onblur="closeCapTip('logonform','safeEdit1')" id=safeEdit1 codeBase="/icbc/newperbank/AxSafeControls.cab#version=1,0,0,13" classid=CLSID:73E4740C-08EB-4133-896B-8D0A7C9EE3CD width=145 height=21><PARAM NAME="_cx" VALUE="3836"><PARAM NAME="_cy" VALUE="556"></OBJECT>
    Is there a way to pass value into the password field with it ID/name??

    Thank you for any advice!!!

Page 14 of 14 FirstFirst ... 411121314

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