Page 4 of 14 FirstFirst 1234567 ... LastLast
Results 121 to 160 of 531

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

  1. #121
    Addicted Member
    Join Date
    Jan 2007
    Posts
    143

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

    Quote Originally Posted by VistaVB
    A .dll page? ***.....

    Are you using the Web Browser control or the .net 1.1 ActiveX Control? Thanks.
    web browser control in .net

    eBay uses .dll pages... "http://my.ebay.com/ws/eBayISAPI.dll?MyEbay"


    (That url only works if you are logged in)

  2. #122

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    Yes, until I actually finish up my 1.1+2.0 browser control that will have all the functionality of both

  3. #123
    New Member
    Join Date
    Jun 2007
    Posts
    5

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

    Hi, I am also trying to code using VB6 to pass values from my application and fill the values in the web pages and submit the page. But the web pages are in frames. I am new to all these...

  4. #124
    New Member
    Join Date
    Jun 2007
    Posts
    5

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

    hi kleinma, my office blocked downloading of zip file. Can you email me the sample codes? My email is dwarfs38@gmail.com. Thanks.

  5. #125
    New Member
    Join Date
    Nov 2001
    Location
    CA
    Posts
    2

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

    I have a vb program using webbrowser control. I wonder is there a way for me from vb to click an anchor tag thru code.

  6. #126

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    VB6 or VB.NET?

  7. #127
    New Member
    Join Date
    Jul 2007
    Posts
    2

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

    Quote Originally Posted by kleinma
    Sorry, I misread it as just an image (as in <img> tag) and not an input element of type image.

    For some reason, I can't seem to access the specific element when its type image via the forms item collection. However this code seems to work:
    kleinma, first Id like to say a big thanks for this thread, it has been invaluable to me.

    However, I had a page input button I wanted to click with no ID or Name along with several other input buttons on the page that I didnt want to click. To get round this I identified the button by its .src

    heres the code..

    Code:
                Dim thisObj As Object
                Dim butInput As mshtml.HTMLInputElement
                thisObj = AxWebBrowser1.Document.getElementsByTagName("input")
                For Each butInput In thisObj
                    If butInput.src = "TheNameOfTheImage.gif" Then
                        butInput.click()
                    End If
                Next
    If you or anyone has a better way of doing it Id be interested to know, but this worked for me and maybe it'll help someone else too.

  8. #128

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    Off the top of my head I can't think of any other way of doing it. It does become a bit trickier when you have to deal with HTML that doesn't provide all the tags that it should (like a name or ID tag).

    So what you are doing is fine.

  9. #129
    Lively Member
    Join Date
    Jan 2007
    Posts
    95

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

    cant we simply click on a form's submit button with the original webbrowser???
    Last edited by extreme.aly; Jul 30th, 2007 at 10:48 AM.

  10. #130

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    yes of course you can, but this thread is about automating input and interaction on webpages via VB code.

  11. #131
    Lively Member
    Join Date
    Jan 2007
    Posts
    95

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

    noo.. i mean automatically click on a submit button... because i'm having a problem while using the navigate2 function of axshdocvw...and i'm getting the same error when i use the InvokeMember("click") function of the original webbrowser provided in VB2005 expresss ed. here is the error screenshot:
    Attached Images Attached Images  

  12. #132

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    the VB2005 managed webbrowser control and the COM webbrowser control act a bit different.

    If you downloaded my sample application, there is a "submit form" example included.

  13. #133
    Lively Member
    Join Date
    Jan 2007
    Posts
    95

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

    yeah i tried to to make it for my application but it show me the error when i use Navigate2 function...

  14. #134

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    Well I am not sure why you are using the navigate2 method...

    usually when you are on a page, and you want to submit it, you just simulate the submit button being clicked. This is what my example code does.

    It sounds like you are trying to do something different.

  15. #135
    Lively Member
    Join Date
    Jan 2007
    Posts
    95

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

    noo...i've no page loaded yet..i'm loading it when the app starts...

    look..i got a webform, which requires some dates and to be submitted...and i want the resulted html code...now i want it to be done multiple time with different dates..like
    for i as integer = 0 to 100
    ' fill the date in the webform
    ' submit the form
    ' get the resulted html
    ' parse the html code
    next

  16. #136

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    you can't quite do it in a loop like that, because the webbrowser is event driven. It fires events when it is doing things so you know what state it is in, and you know when you should proceed.

    So to accomplish a repetitive task like that, you would need to do something like the following:

    Lets say you have page1.htm (which is the page that has the fields that need to be filled in), and page2.htm (which is the page the form submits to and has the resulting HTML code you want)

    Code:
    -Navigate to page1.htm
    -When the DocumentCompleted event of the webbrowser fires the page has fully loaded
        check the current URL of the WB control
            if its page1.htm, fill in the values you want and submit form
            if its page2.htm, then page1 was just submitted, so get the resulting HTML code.

  17. #137
    Lively Member
    Join Date
    Jan 2007
    Posts
    95

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

    yeah i have done the same thing in the original browser but i have to click to button each time... the code is something like this:
    Code:
    dim counter as integer = 0
    prv sub form_onload(...)
    webbrowser1.documenttext = mycode
    ' press submit button code should be here
    end sub
    
    prv sub webbrowser1_documentcomplete(...)
    if webbrowser1.documenttitle = submitted_page_title then
      parse(webbrowser1.documenttext)
      if counter <> 101 then
        webbrowser1.documenttext = mycode
        ' press submit button code should be here
      end if
    end if
    end sub
    
    prv sub parse(html as string)
    ' parse html
    counter += 1
    end sub
    i just want the button to be clicked automatically without making a BIG change..i think you understand

  18. #138
    New Member
    Join Date
    Aug 2007
    Posts
    15

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

    Hi kleinma,
    I have been following this post for couple of days. I would like to mention that I have never seen anyone so HELPFUL.. You rock!!

    well, i got a problem in doing the same thing. I am using Vb.net 2005 express edition, wherein i am creating an application, that would send in data to the web form fields and get the results. It's actually a ASP.NET webpage, that calculates based on the values entered in the fields.

    I don't know why Mmhtml code, didn't work for me, so i am working with the web browser control 2.0, with the following code:

    WebBrowser1.Document.All.Item("IDTextBox").InnerText() = "202"
    WebBrowser1.Document.All.Item("PasswordTextBox").InnerText() = "123"
    WebBrowser1.Document.All.Item("SelectButton").InvokeMember("click")

    PROBLEM: after I execute this code, the web browser loops it, making the page to reload, input the variables and again click it.. it forms a vicious circle..

    any suggestions..

  19. #139

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    What event did you put that code in?

  20. #140
    New Member
    Join Date
    Aug 2007
    Posts
    15

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

    ohh great!!
    salutations to you...

    you are online..

    well i posted this code as follows:


    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

    WebBrowser1.Document.All.Item("IDTextBox").InnerText() = "202"
    WebBrowser1.Document.All.Item("PasswordTextBox").InnerText() = "123"
    WebBrowser1.Document.All.Item("SelectButton").InvokeMember("click")
    End Sub

    I am really new to this field, any help would work a long way for me..

  21. #141

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    Are you able to provide me the URL that you are trying to work with? That makes it easier for me to be able to give you a 100% working answer.

    The problem most likely lies somewhere in the fact that an ASP.NET page posts back to itself, not a different page, which could cause the loop you describe.

  22. #142
    New Member
    Join Date
    Aug 2007
    Posts
    15

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

    well.. its only for you..

    [REMOVED]

    if you have it saved, i can remove it from the public access.. This forms a part of high profile research group..i hope you understand my situation..
    Last edited by karthik120; Aug 2nd, 2007 at 01:21 PM.

  23. #143

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    yeah I saved it.

    You need a mechanism, either in your VB app, or in the ASP.NET page, to let you know the current state of the ASP.NET page.

    For example, the only visual indicator I see on that page to let me know if an ID/Password were submitted, is the label that says "Select a building" which then changes to "You selected: oh god in Atlanta, Georgia" when I put in the ID/Password.

    If you have access to the ASP.NET source code, I would either add a hidden field to indicate if an ID/Password has been submitted. The VB app could then read the value of that hidden field to decide if it should refill the boxes and submit, or not.

    If you don't have access to the source code, you could try parsing out the HTML text to find the words "Select a building:" to indicate if you should autofill and submit, however that is more error prone and subject to break if the text on the page ever changes.

  24. #144
    New Member
    Join Date
    Aug 2007
    Posts
    15

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

    i tried stopping the navigation after i was able to invoke the submit button. But, i was not able to invoke "Click" button the next time in the same page..

  25. #145
    New Member
    Join Date
    Aug 2007
    Posts
    15

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

    OOps... that would hit hard on me..

    If you have seen, there are multiple button on the webpage, i don't know if i could save the page temporarily, and hit the next button to execute the complex calculation....

    Any other way out of this mess..

    It actually selects the building on the first button, then we are allowed to change parameters, then the next button would be for saving the changed parameters for that selected building.. Few more buttons that would lead you to next page, where we got to do the same for other calculation.. ..

  26. #146

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    well do you have access to the ASP.NET source code?

  27. #147
    New Member
    Join Date
    Aug 2007
    Posts
    15

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

    Yeah, but i ain't know much about ASP.NET, but i know it is in complete mess.
    So i was trying to work other way out..

    I have the aspx file attached.. If you could have a look at it..
    Attached Files Attached Files

  28. #148
    New Member
    Join Date
    Aug 2007
    Posts
    15

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

    Any solutions...

  29. #149

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    I don't need the aspx file really.

    My suggestion would be that you add a hidden field to the aspx page. Call that field hdnStatus

    In the code behind for the aspx page, in the button click code for each button have that button set the hdnStatus field. Then your VB app that hosts the WB control can query that field to get the current status:

    For example

    When user puts in ID/Password and clicks the button to get the building, the ASPX page fires the codebehind code for the button click event of that button. In that code you verify ID/Password and if its correct you display the building they selected. You should also there set the hdnStatus field with some value to indicate there has been a successful login. Lets say you set the hidden field text to "BUILDING_RETRIEVED"

    Then in your VB code, in the documentcompleted event of the WB control, look at the value of hdnStatus in the webpage. If its blank, then that should indicate nothing has been done, and the ID/Password should be automatically entered and the button should be clicked. If it says "BUILDING_RETRIEVED" then it should not autofill and click the button again.

    You could use this same approach for all the buttons on the page. Just set different values in the hidden field, and that value can be looked at by your VB app so it can take the proper action.

    Hope this makes sense.

  30. #150
    New Member
    Join Date
    Aug 2007
    Posts
    15

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

    well makes a lot sense.. i would try to work on it..

    One more dumb question
    Is there a way to trigger "code behind code" that leads me to the solution without clicking the button? If yes, it would make my life a lot easier..

  31. #151

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    not really, in order for the ASP.NET page to behave properly, you need to fire the button click in the HTML. This is because ASP.NET pages employ built in javascript to do certain things when a button is clicked and the page posts back to the web server. If you were to simply submit the form without clicking the button, you would get unknown/undesired results.

    Just try the method I described to you before, I think once you get it going, you will find it very easy to implement.

  32. #152
    New Member
    Join Date
    Aug 2007
    Posts
    15

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

    ohh.. i didnt notice that there was a new page...

    Though i have access to aspx files.. i don't think my professor would allow me to add anything to it. What i am developing is an add in (windows application) feature. They would like the asp page to function as it was. How about solution 2: parsing out HTML for the button? I'm sure, the webpage contents will never be changed..

  33. #153
    New Member
    Join Date
    Aug 2007
    Posts
    15

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

    how should i parse the webpage to get to the button..

  34. #154

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    you dont need to get the button, since the only thing that visibly changes on the page is the text telling you to either enter an ID/Password, or it tells you what building you selected, you should look at the HTML source in the browser control, and look for the specific strings that will indicate to you if the fields were already filled out and the button was clicked.

  35. #155
    New Member
    Join Date
    Aug 2007
    Posts
    15

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

    Alrighto...
    You are amazing..
    Thank you so much.. would work on it..

  36. #156
    New Member
    Join Date
    Aug 2007
    Posts
    15

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

    it didn't work either, do you think HTTPwebreqest might be helpful, for my problem..

  37. #157
    Addicted Member
    Join Date
    Jan 2007
    Posts
    143
    I need to click a submit button, based off of this information...

    Type - "Submit"
    TabIndex - "1"
    AccessKey - "s"
    Value - "Save Signature"
    Class - "button"


    there is no name or id... so how do I go about doing that (without focusing the control that comes before it when you tab through, and then using sendkeys.send("{TAB}{ENTER}")



    Here is the actual code for the button
    Code:
    <input type="submit" class="button" value="Save Signature" accesskey="s" tabindex="1" />

  38. #158

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    if the button has no ID or Name value, then you can do one of 2 things

    1) Submit the form directly by calling the forms .Submit() method (which is shown in my sample code)

    2) Loop the elements of the form until you find one thats value is equal to "Save Signature" and then you know you are on the right input element, and you can invoke a click on it.

    I think #1 is the better method.

  39. #159
    Addicted Member
    Join Date
    Jan 2007
    Posts
    143

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

    Quote Originally Posted by kleinma
    if the button has no ID or Name value, then you can do one of 2 things

    1) Submit the form directly by calling the forms .Submit() method (which is shown in my sample code)

    2) Loop the elements of the form until you find one thats value is equal to "Save Signature" and then you know you are on the right input element, and you can invoke a click on it.

    I think #1 is the better method.
    How about this, instead of doing that...
    Code:
    <form action="profile.php?do=updatesignature" enctype="multipart/form-data" method="post" name="vbform" onsubmit="return vB_Editor['vB_Editor_001'].prepare_submit(0, 0)">
    What if I use the line WebBrowser1.Document.all.item("vbform").invokemember("post")

    I can't try it because I don't have VB on this computer. So, I'm wondering if that would work with a normal web browser for the form? I'd rather use a regular web browser if I can, plus it would be just 1 line of code, rather than several functions.

  40. #160

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

    I dont think that will work, but i suppose you could try it.

    I still think you should just call the forms .Submit method.

Page 4 of 14 FirstFirst 1234567 ... LastLast

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