Page 10 of 14 FirstFirst ... 78910111213 ... LastLast
Results 361 to 400 of 531

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

  1. #361
    New Member
    Join Date
    Nov 2008
    Posts
    2

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

    Hi kleinma, First thanks for sharing all this. It's been really usefull. Im working on some automation on a site containing AJAX on some processes. The problem is when I analize html code (on pages with AJAX) because (.net 2008) webbrowser shows me source of original html page (the one that loaded first).
    Is there any workarround to solve this? I need the html source code of updated page (after ajax's been executed).
    I have tried
    wb.nabigate("javascript:'<xmp>' + window.document.body.outerHTML + '</xmp>'") with no success, but curiosly it works fine when pasted on IE. Am I missing something?
    Thanks again.
    Ariel

  2. #362
    New Member
    Join Date
    Dec 2008
    Posts
    13

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

    Hi, thanks for the source you have provided but im going for something a bit different and i couldnt seem to figure out your src to well. I dont want a webbrowser, not one thats visible anyway but i want it to log into the website automatically with no actualy input from the user. apart from username and password

    Code:
    Public Class Form1
        Public Event DocumentCompleted As WebBrowserDocumentCompletedEventHandler
        Dim instance As WebBrowser
        Dim handler As WebBrowserDocumentCompletedEventHandler
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            AddHandler instance.DocumentCompleted, handler
            instance.Navigate("http://www.warez-bb.org/login.php")
        End Sub
        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
            .Document.Forms(0).All("username") = "dreadfear"
            instance.Document.Forms(0).All("username") = "*****"
            instance.Document.Forms(0).All("submit").Click()
        End Sub
    End Class
    I cant seem to place anything inside of the form boxes or get it to click submit, any help is greatly appreciated im having alot of troulbe with this.

    Thanks in advance.

  3. #363

    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

    just put the webbrowser control off the visible portion of the form. It needs to actually be visible for the automations to work (being visible and being able to see it don't have to be the same thing).

    You could also do something like putting the webbrowser in a panel, and covering it with another control that is set docked to fill to cover over the browser control.

    You usually do want SOME way for the user to be able to actually view the webpage, in the event automation fails for some reason, like the page doesn't load properly, it times out, it has changed and your automation no longer works, etc...

  4. #364
    New Member
    Join Date
    Dec 2008
    Posts
    3

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

    Hi, I have 2 questions. I am tring to automate a file upload/download process and here is the html code:
    <input type="file" name="FileUpload1" id="FileUpload1">
    <input type="submit" name="btnUpload" value="Update" id="btnUpload">
    1. The SetAttribute("value", "c:\file1.xls") does not work. Which property should I use?
    2. The submit button does two things - upload the specified file and then download another file, say file2.xls. How do I catch the file2.xls?

    Thanks!

  5. #365
    New Member
    Join Date
    Dec 2008
    Posts
    13

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

    Quote Originally Posted by kleinma
    just put the webbrowser control off the visible portion of the form. It needs to actually be visible for the automations to work (being visible and being able to see it don't have to be the same thing).

    You could also do something like putting the webbrowser in a panel, and covering it with another control that is set docked to fill to cover over the browser control.

    You usually do want SOME way for the user to be able to actually view the webpage, in the event automation fails for some reason, like the page doesn't load properly, it times out, it has changed and your automation no longer works, etc...
    Ok thats good but how do i actually get it to fill in forms or get it to click a button, i have no idea how to do that and no tutorial i find knows either, ive been searching for a long time

  6. #366
    New Member
    Join Date
    Dec 2008
    Posts
    1

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

    Hello, I need help, I am using VB 2008

    Here is what I want to do, first I want auto fill a textbox in my web browser and then submit it, and after that I want to retrieve data from the text on the web page and paste it into the textbox in my program,

  7. #367
    New Member
    Join Date
    Dec 2008
    Posts
    3

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

    Quote Originally Posted by dreadfear
    Ok thats good but how do i actually get it to fill in forms or get it to click a button, i have no idea how to do that and no tutorial i find knows either, ive been searching for a long time

    I am struggling with the web automation for the last few weeks too. Hope this would help.

    dim mBrowserCompletedas boolean

    Private sub Form_Load
    '--- open the web page and wait for it to finish
    mBrowserCompleted= false
    WebBrowser1.Navigate("www.mysite.com")
    WaitForBrowserToComplete()

    '--- enter all the fields
    webbrowser1.document.all("field1").SetAttribute("Value") = "abc"
    webbrowser1.document.all("field2").SetAttribute("Value") = "xyz"
    ...
    '--- submit the form and wait for the response
    mBrowserCompleted= false
    webbrowser1.document.Forms(0).InvokeMember("submit")
    WaitForBrowserToComplete

    '--- do whatever ...

    end sub

    Private sub WaitForBrowserToComplete()
    do
    application.DoEvents
    loop until mBrowserCompleted
    end sub

    Private sub Webbrowser1_DocumentCompleted(.......)...
    application.DoEvents
    mBrowserCompleted= True
    end sub

  8. #368
    New Member
    Join Date
    Dec 2008
    Posts
    3

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

    Quote Originally Posted by J. Jethro
    Hello, I need help, I am using VB 2008

    Here is what I want to do, first I want auto fill a textbox in my web browser and then submit it, and after that I want to retrieve data from the text on the web page and paste it into the textbox in my program,

    Take a look at my post( #377). To retrieve data from the text on the web page and paste it into the textbox in your program:

    txtField1.Text = Webbrowser1.document.all(field1").GetAttribute("Value").ToString()

    ...

  9. #369
    Lively Member
    Join Date
    Jan 2003
    Posts
    66

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

    Well, I am not sure if this is where I need to post this but others sent me think ing it was so here I go.

    I have some info on a web page I want to put into my app I am making.

    I will show what I would most like to do but then end with any work arounds or things I might have to just settle with if it can be done at all ...

    OK .... Here is the link to the web site http://www.tulsapolice.org/udsw.html

    About middle way down you will see an area called Current calls ... this little box area contains the current police calls for my area .... oh by the way ... it refreshes every 60 seconds .. keep that in mind ...
    Within in this box area or frame or div or whatever you call it it contains two main peices of information
    1. Description ie; Theft
    2. Location ie; 123 Some Street Tulsa Ok

    Ideally I would like to be able to get this updated info every 60 seconds and put it into my form/app displaying them in some control ... maybe a listbox or listview or perhaps just strait to an xml file .... dont matter just as long as its something I can access the info ....

    Ok, I am not a web guru ... so maybe I am over looking the obvious and this info cant be accessed that way .. so ... how about option 2 then

    Just grab the whole box/frame/div and display it in my app just like its seen on the page .... but .... get the updated info every 60 seconds ...

    NOTE: This really doesnt allow me to do what I would most like ... as I am hoping to be able to access the info so I can keep record of what crimes are happening within certain areas ....

    Well, I hope I have explained good enough as to what I am hoping I can do ... so, can you point me in the right direction ....


    Mark

  10. #370

    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 the first thing to do when you want to automate a website or screen scrape data from a site is look at the site source HTML to see what you are dealing with.

    They are using ASP.NET it looks like, and that table is probably getting written out on the fly from the server, and unfortunatly, they don't attach any name or id attributes to the table tags for the data you want.

    This doesn't make it impossible, just more of a pain because when you have some sort of unique attribute identifier, it makes it very easy to grab the specific elements of the DOM you want, and parse the data.

    Instead, you have to do something like grab all the tables in the DOM, and find the table that has a TD with inner text containing "Current Calls". Then you know you have gotten the right table element, and you can parse it from there. Just keep in mind as soon as they decide to change the page at all, your code likely will break and need to be modified. That is the nature of automating someones website that has not designed their site with automation in mind.

  11. #371
    Lively Member
    Join Date
    Jan 2003
    Posts
    66

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

    Yes, I looked at the source and it seems if I am looking at this right this is where it is all happening.
    Code:
    <div id="udecalls">
      <iframe name="UDSW" width="520" src="http://www.cityoftulsa.org/divisions/divisions.aspx?div=udsw" height="222"> Your browser does not support inline frames or is currently configured not to display inline frames.</iframe>
    
    </div>
    Its in an iframe within a div called udecalls ..... however the url itself seems interesting .... hmmm could it be this is what we are looking at being displayed int he iframe???
    I will look into that and check it out.

    If so I may simply be able to display that but still this doesnt help me actually grab the info .. instead it would only let me display it ...

    I will check out if I can display it but would love to be able to actually read it ...
    Any thoughts will be appreciated
    Ill be back after I test the url

    Mark

  12. #372
    Lively Member
    Join Date
    Jan 2003
    Posts
    66

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

    Yep, this url http://www.cityoftulsa.org/divisions....aspx?div=udsw

    Actually will allow me to display it on my app just as it is seen within the iframe.

    However ..... could you give me any insight as to how I would actually display it on my app and how would tell my app to refresh it every 60 seconds?

    Or point me to where I can find this out ...
    Mean while I will do some searching on what control I will need ... thinking its webbrowser control ... but will reasearch it ...

    Be back later

    Mark

    Oh thanx for pointing me to the source code

  13. #373
    Lively Member
    Join Date
    Jan 2003
    Posts
    66

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

    Ok I think I have this figured out ... well at least I have figured out that the info should be easily accessable ... I just dont know for sure how to parse this sort of info but let me give you an idea what I think then you can tell me where I am going wrong ...



    Ok this url http://www.cityoftulsa.org/divisions....aspx?div=udsw
    It shoots the contents of what is in the frame that we are seeing on the page

    I simply put the url in my browser and wa la I can see exactly what is on their web page.
    But can I get the info from it ... yes I would think it would not be so hard ... dont know how yet as I do not know how to parse this following info but here it goes...

    First click on the url above and you will see the data I need to parse especially if you view the source code of the above url
    It will look like this ... this is actually a cut paste of the source code

    Code:
    <TABLE style="BORDER-RIGHT-STYLE: solid; BORDER-RIGHT-COLOR: black" cellSpacing="0" cellPadding="0"
    				width="475" border="1">
    				<TR>
    					<TD style="FONT-WEIGHT: bold; FONT-SIZE: 14pt; COLOR: darkkhaki; FONT-STYLE: italic; FONT-FAMILY: Arial; BACKGROUND-COLOR: black"
    						noWrap align="center"><FONT face="Times New Roman">Current Calls</FONT></TD>
    
    				</TR>
    				<TR style="FONT-WEIGHT: bolder; FONT-FAMILY: Arial" align="left">
    					<TD style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: arial; BACKGROUND-COLOR: white">&nbsp;<FONT face="Times New Roman" size="3">Calls 
    							Assigned to Officers</FONT></TD>
    				</TR>
    				<tr>
    					<td style="BACKGROUND-COLOR: white"><table cellspacing="0" cellpadding="4" rules="all" border="4" id="dgCurrent" style="color:Black;background-color:White;border-color:Black;border-width:4px;border-style:None;font-family:Times New Roman;font-size:X-Small;width:475px;border-collapse:collapse;">
    	<tr style="color:Black;background-color:White;font-family:Times New Roman;font-size:X-Small;font-weight:bold;">
    		<td>Description</td><td>Location</td>
    
    	</tr><tr style="color:Black;background-color:White;">
    		<td>Traffic Stop</td><td>4800 S YALE AVE </td>
    	</tr><tr style="color:Black;background-color:White;">
    		<td>Traffic Stop</td><td>5200 S LEWIS AVE </td>
    	</tr><tr style="color:Black;background-color:White;">
    		<td>Traffic Stop</td><td>3400 E BAWB EXPY </td>
    
    	</tr><tr style="color:Black;background-color:White;">
    		<td>Non Injury Collision</td><td>FAIRGROUNDS @4100 E 21 ST S </td>
    	</tr><tr style="color:Black;background-color:White;">
    		<td>Robbery Alarm</td><td>2400 E 32 ST S </td>
    	</tr><tr style="color:Black;background-color:White;">
    		<td>Larceny</td><td>2000 E 81 ST S </td>
    
    	</tr><tr style="color:Black;background-color:White;">
    		<td>Larceny</td><td>7100 S SHERIDAN RD </td>
    	</tr><tr style="color:Black;background-color:White;">
    		<td>Pickup Found Property</td><td>5300 S YALE AVE #1100 </td>
    	</tr><tr style="color:Black;background-color:White;">
    		<td>Pickup Runaway Juvenile</td><td>1100 S FULTON AVE </td>
    
    	</tr><tr style="color:Black;background-color:White;">
    		<td>Suspect at Scene</td><td>3700 W 53 PL S </td>
    	</tr><tr style="color:Black;background-color:White;">
    		<td>Suspect in Custody</td><td>4100 S YALE AVE </td>
    	</tr>
    </table>
    Sorry for it being so much ... but as you can see it shows the info I need to grab

    Ok the question is ... how do I grab this source code from this url and then parse it for the needed info?

    Any ideas anyone as to where I can see how to parse this ?

    Mark

  14. #374
    Lively Member
    Join Date
    Jan 2003
    Posts
    66

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

    Ok .... here is what I have tried so far I think I might be on the right track however this code is not pulling all the info into the string as I thought so I am obviously going about this the wrong way
    heres the code I am using though maybe it will spark some ideas

    As I simply want to parse the source or the url

    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim strHtml As String
            strHtml = GetPageHtml("http://www.cityoftulsa.org/divisions/divisions.aspx?div=udsw/")
            rtbParse.Text = strHtml
    
        End Sub
        Public Function GetPageHtml(ByVal URL As String) As String
            Dim objWC As New System.Net.WebClient()
            Return New System.Text.UTF8Encoding().GetString(objWC.DownloadData(URL))
    
    
        End Function
    Any thoughts?

    Mark

  15. #375
    New Member
    Join Date
    Jan 2009
    Posts
    1

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

    ....
    Last edited by saphox; Jan 24th, 2009 at 04:01 PM.

  16. #376
    Lively Member
    Join Date
    Jan 2003
    Posts
    66

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

    Ok I have done a lot of searching and playing with various code ... some of it I sort of get the idea of how it works and but find I do not yet understand it enough to over come some trouble s I am getting into ...

    Ok ... you were right ... this is not going to be an easy task ... but its one I am not yet giving up on as I am getting close ... or at least feel I am ...

    I though I would show what I have done ... what results I am getting and then just maybe you might point out how I can improve on it ..

    Ok using link I found it would not parse the html because of &nsb < or something like that ... they had to be removed also it would not parse the metta data for some reason but if the two were removed from the html it parsed it just fine ...


    So before I write code to remove them which I found some examples of who to do this ....

    I decided to remove them myself and practice with the parsing side of the code ...
    Here is the code and html being parsed .....
    Code:
        Dim html = <html>
                           <head>
                               <title>Current UDSW calls</title>
    
                           </head>
                           <body>
    
    
                               <table style="border-right-style: solid; border-right-color: black;" border="1" cellpadding="0" cellspacing="0" width="475">
                                   <tbody><tr>
                                       <td style="font-weight: bold; font-size: 14pt; color: darkkhaki; font-style: italic; font-family: Arial; background-color: black;" align="center" nowrap="nowrap"><font face="Times New Roman">Current Calls</font></td>
                                       </tr>
    
    
                                       <tr>
                                           <td style="background-color: white;"><table id="dgCurrent" style="border: 4px none Black; color: Black; background-color: White; font-family: Times New Roman; font-size: x-small; width: 475px; border-collapse: collapse;" border="4" cellpadding="4" cellspacing="0" rules="all">
                                               <tbody><tr style="color: Black; background-color: White; font-family: Times New Roman; font-size: x-small; font-weight: bold;">
                                                   <td>Description</td><td>Location</td>
    
                                                   </tr><tr style="color: Black; background-color: White;">
                                                       <td>Non Injury Collision</td><td>6500 S YALE AVE </td>
                                                   </tr><tr style="color: Black; background-color: White;">
                                                       <td>Attempt to Serve Warrant</td><td>1200 S QUAKER AVE </td>
                                                   </tr><tr style="color: Black; background-color: White;">
                                                       <td>Burglary from Vehicle</td><td>4100 S YALE AVE </td>
    
                                                   </tr><tr style="color: Black; background-color: White;">
                                                       <td>Intoxicated Pedestrian</td><td>2500 W 47 ST S </td>
                                                   </tr><tr style="color: Black; background-color: White;">
                                                       <td>Fraud</td><td>4400 E 31 ST S </td>
                                                   </tr><tr style="color: Black; background-color: White;">
                                                       <td>Fraud</td><td>5900 E 56 ST S </td>
    
                                                   </tr><tr style="color: Black; background-color: White;">
                                                       <td>Hazard</td><td>1900 E 71 ST S </td>
                                                   </tr><tr style="color: Black; background-color: White;">
                                                       <td>Larceny</td><td>9500 S DELAWARE AVE </td>
                                                   </tr><tr style="color: Black; background-color: White;">
                                                       <td>Parking Violation</td><td>1900 S CINCINNATI AVE </td>
    
                                                   </tr><tr style="color: Black; background-color: White;">
                                                       <td>Receive Information</td><td>SK-NIMITZ @3100 E 56 ST S </td>
                                                   </tr>
                                               </tbody></table></td>
                                       </tr>
                                       <tr>
                                           <td id="TD1" style="background-color: white;" align="center">6 calls awaiting assignment</td>
    
                                       </tr>
                                   </tbody></table>
                           </body>
                       </html>
    
    '''' ............. Below is my code ....................
    
    Dim tabString = From ts In html...<tbody>
    
    
            txt1.Text = tabString.Count()
    
    
    
    
    
            For i = 0 To 24
                ListBox1.Items.Add(tabString.<tr>.<td>(i).Value)
    
            Next
    Ok here is what I am getting ....

    Listbox fills with the data .... almost perfect ... almost is the operative word

    Lets say the data in the fields above was this for example

    <td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td>

    When it pulls out the data and is loaded in the listbox the data should look lik this
    1
    2
    3
    4
    5
    6
    Instead it looks like this
    1
    123456
    2
    1
    2
    3
    4
    5
    6
    Weird .....
    But hey, it was cool, cause I at least parsed it LOL
    I about did the Walter Brennan dance ....

    Ok ... not sure how to fix this I have tried several dozen attempts with not much improvement

    ALSO .... as you can see in the For statement I i as interger a value of 0 to 24
    Its because I know there are at the moment 24 <td>Items with data in them</td>
    ..... I need to figure out hwo to count them or make go to end and stop or something like that
    I tried to do
    Code:
     For i As Integer = 0 to tabString.count
    BUT, the valu of tabString.count is only 2 which means its only counting up to 3 and stopping but if I remove tabString and just put i = 0 to 24 it will go right to the end and do what it is supposed to do ...

    Any thoughts how I can clean this up and or a better approach

    Please ... I really want to pull this off no matter how much work and learning I got to do ...

    Mark

  17. #377

    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

    Mark, I had time today to look at this for you finally.

    Not sure exactly what you want to do with the data, but I did you up a quick parsing routine that will extract the data from the HTML and list it in 2 listboxes. You should be able to take this sample, and understand how to grab this data and do whatever you want with it.

    So make a new WinForms project, and add a webbrowser control, and 2 listboxes

    So you have Webbrowser1, Listbox1, Listbox2

    Then paste this code into Form1

    Code:
        Private _URL As String = "http://www.cityoftulsa.org/divisions/divisions.aspx?div=udsw"
    
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            WebBrowser1.Navigate(_URL)
        End Sub
    
        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    
            'GET CURRENT CALLS TABLE
            Dim myTable As HtmlElement = WebBrowser1.Document.All("dgCurrent")
    
            'MAKE SURE WE GOT A VALID TABLE OBJECT
            If myTable IsNot Nothing Then
                'LOOP ALL ROW ELEMENTS IN TABLE
                For Each MyElement As HtmlElement In myTable.GetElementsByTagName("TR")
                    'THERE SHOULD BE 2 TD ELEMENTS PER ROW
                    Dim myTDTags As HtmlElementCollection = MyElement.GetElementsByTagName("TD")
    
                    'IF WE GOT 2 TD ELEMENTS, WRITE THEM TO 2 LISTBOXES
                    If myTDTags.Count = 2 Then
                        ListBox1.Items.Add(myTDTags(0).InnerText)
                        ListBox2.Items.Add(myTDTags(1).InnerText)
                    End If
    
                Next
            End If
    
        End Sub
    run it and there you go

  18. #378
    Lively Member
    Join Date
    Jan 2003
    Posts
    66

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

    WOW .......


    This works great ........... Now I am going to go play with it a bit se if I can modify it to drop the webBrowser control

    Which looks like I can ..... we will see but none the less this is absolutely marvelous

    Thank you


    Mark
    Last edited by Mark B; Jan 23rd, 2009 at 06:10 PM.

  19. #379

    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

    Worst case you could always set the browser to a very small size, and then set its location to a negative x/y value so its not actually visible on the form. I don't believe (can't remember off the top of my head) that the browser works properly if you just set its visible property to false. I have done projects where I simply cover over the browser control with a panel or something.

  20. #380
    Addicted Member
    Join Date
    Jan 2009
    Posts
    130

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

    its full of errors with the "mshtml.*"
    its all errors!!!

  21. #381
    Lively Member
    Join Date
    Jan 2003
    Posts
    66

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

    Yes but I cant help the fact their web master well isn't a web master but I can say this code has been fantastic .... I am also learning now how to parse html with linq and LINQ is amazingly simple and powerful stuff. Again ... cant thank you enough for assisting me with this ... since this code ... seeing how to actually access the html has really just been awesome .... I have used this very code exampl to allow me to now get info from several pages ..

    Seeing it can be done has now as I said with LINQ to pull info and parse exact o specific info right from pages ....

    ANyway thank you ... I learn so much by example .. I really appreciate you taking the time

    Mark

  22. #382
    New Member
    Join Date
    Feb 2009
    Posts
    3

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

    Many of the concepts can be used in VB6, however the specific .NET code will not be a simple copy/paste into VB6.

    If you know .NET and VB6 you could probably easily port this code over to VB6

    If I ever have some free time, maybe I will try, since you are the second person to ask in just a few days, but for now its really just .NET 2003/2005
    __________________

    Hi,

    In the very first page you said you will provide Manipulated code for "WebpageManipulation.zip" in VB6 also.
    I am trying to fill a textbox and conduct a search on http://www.fujitsu-siemens.ie/suppor...ranty_ent.html through excel VBA.
    But not being successful.
    Could you provide code in VB6 and help to solve this problem?

  23. #383

    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 know both, but I don't have any plans to port this code over to an old language.

    If anything, I will be updating this code for newer .NET versions.

  24. #384
    New Member
    Join Date
    Feb 2009
    Posts
    1

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

    Hi there kleinma! I absolutely worship you after reading the entire thread and observe how good you are in programming. How I wish I could be like you someday.

    Well here's what I wanna ask help for. I am migrating from VB6 to VB 2008 since I was able to get the copy of the program already. I am a newbie to Web Controls, and here's the favor that I wanna ask you of.

    I have a Wordpress enabled blog and I made a program that will auto generate the content within VB. All I wanna do is to create a button that will automatically transfer the contents to the web control that I made.

    Here's the source code of the .php page when posting a new content:
    Whew... It was too long. I'll send it to you instead.

    Sorry if it have to be really long. That is the contents of the "add new content" part. I can't ask too much by letting you do the entire job. I just want to know how will I be able to define the fields within this form and how can I manipulate/fill them out using VB? Including just the check boxes and radio buttons.

    All I wanted to do is have my text fields' content transferred correspondingly. Then have it execute the "publish" button, validate if the page is different (meaning the content is posted already) and proceed to another web page.

    Hope you could help me out with this. I'd really appreciate it. Thanks and more power!

  25. #385
    New Member
    Join Date
    Feb 2009
    Location
    Sarajevo Bosnia and Hercegovina
    Posts
    4

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

    Hi Kleinma,
    Very good job, but I have one questions.
    In a web page I try to fill three combobox and then click on submit button. Web pages is .aspx,
    ComboBox in page
    <label for="control28_ddDateOfPubMonth" id="control28_lbDateOfPubMonth" class="hide">Month</label><select name="control28$ddDateOfPubMonth" id="control28_ddDateOfPubMonth" class="date-month">
    <option selected="selected" value="-1" disabled="disabled">Month</option>
    <option value="1">January</option>
    ...

    and button is
    <a id="control28_btnSubmit" href="javascript:__doPostBack('control28$btnSubmit','')">Search</a>

    How can I fill this three combo box from forms and then click onButton. This webPage do post back and I need render search result.
    I'm desperate.
    I try this
    DirectCast(GetCurrentWebForm.item("control28_btnSubmit", 0), mshtml.HTMLButtonElement).click()
    but dosen't work. Never Click on button in this page.

    I try WebZinc but dosen't work.

  26. #386

    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

    From the HTML you posted, it looks like the submit mechanism on that page is an anchor (<A>) tag, and not an HTML Button. So casting it to an HTMLButtonElement is not going to do the trick.

    Try casting it to a (I think the class name is) HTMLAnchorElement, and try calling click on that instead.

  27. #387
    New Member
    Join Date
    Feb 2009
    Location
    Sarajevo Bosnia and Hercegovina
    Posts
    4

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

    Tnx for you replay.
    Do you mean
    DirectCast(GetCurrentWebForm.item("control28_btnSubmit", 0), mshtml.HTMLAnchorElement).click()

    when I do this I get NullReferenceException.

    Another thing when I use this WebZinc componente I have this error
    Server Error in '/' Application.
    Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.

    Is it possible to make general automation on this web page???

  28. #388
    New Member
    Join Date
    Feb 2009
    Posts
    2

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

    Resolved my selecting of radio buttons with the following:

    Code:
            
    Dim theElementCollection2 As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
            For Each curElement As HtmlElement In theElementCollection2
                Dim controlValue As String = curElement.GetAttribute("Value").ToString
                If controlValue = "VALUETOSELECTHERE" Then
                    curElement.InvokeMember("click")
                End If
            Next
    Last edited by xetic; Feb 24th, 2009 at 01:53 AM.

  29. #389
    New Member
    Join Date
    Feb 2009
    Posts
    3

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

    Thanks, I have solved my previous problem.

    But now I have a different one.
    Please open this URL http://support.euro.dell.com/support...dt1&l=en&s=bsd.
    It will open Dell warranty search page. If service tag is blank kindly fill it with JNK630J. Now it will navigate you on a new page. On this newpage you will find a new link as Change Service Tag. If I click on the link it opens a new Dialogue and ask to enter new service tag no. I am not able to get the access of this dialogue box. I want to fill a new value in this box and want to click on Go.

    How can I get access of this dialogue.
    How can fill new no and click on Go.

  30. #390
    New Member
    Join Date
    Feb 2009
    Posts
    1

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

    Hi all im new to this one...

    I am trying to make an app in vb.net (part of visual studio 2005) that will do the following:

    goto website login page and attempt login
    if login fail goto website signup page and attempt signup
    if login or signup success then
    goto upload page and auto fill upload page and submit.

    I would like to do this for say 10 sites.

    I have tried 2-3 and managed ok but found that that doing more is very difficult.

    Does anyone have any ideas as to how i can keep track within the code of say different upload page form items from the different sites.

    Basically I want to make an auto submitter for my video to different video sites and the test for different site form elements and their names are making my code huge...

    Just wondering if anyone knows an easier way.

    Thanks

  31. #391
    New Member
    Join Date
    Feb 2009
    Posts
    2

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

    Quote Originally Posted by beldoy
    Hi all im new to this one...

    I am trying to make an app in vb.net (part of visual studio 2005) that will do the following:

    goto website login page and attempt login
    if login fail goto website signup page and attempt signup
    if login or signup success then
    goto upload page and auto fill upload page and submit.

    I would like to do this for say 10 sites.

    I have tried 2-3 and managed ok but found that that doing more is very difficult.

    Does anyone have any ideas as to how i can keep track within the code of say different upload page form items from the different sites.

    Basically I want to make an auto submitter for my video to different video sites and the test for different site form elements and their names are making my code huge...

    Just wondering if anyone knows an easier way.

    Thanks
    If you want to do it on 10 sites, I would recommend you manually make sure you have accounts created at each one, then define credentials/path to upload form/form elements based on current url. That's my opinion based on the way I would code a site with a massive user base while trying to discourage bots. I wouldn't use standard form element names to make it easily automated, and even when not trying to make things difficult you will still most likely end up with 5 or more different form field name variations.
    Last edited by xetic; Feb 23rd, 2009 at 11:31 AM.

  32. #392
    Member
    Join Date
    Jul 2008
    Posts
    42

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

    Hello, I am trying to autofill a form that has no name or id. There are two forms on the page; the first is hidden while the second is the only visible form.

    The visible form is a captcha and I have my COM webbrowser setup so that when it finds a captcha it asks for user input using inputbox()

    I have tried countless different ways but I CANNOT find out how to fill the captcha form. Form some reason it refuses to fill.

    Please help, oh and if needed I can supply my code and the html I am trying to use it on

  33. #393
    New Member
    Join Date
    Mar 2009
    Posts
    1

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

    hello. im using vb 2008 and trying to make a login program for sfront.ijji.com

    currently i have this:
    vb Code:
    1. Public Class Form1
    2.  
    3.  
    4.  
    5.  
    6.     Private Sub CmdLogin_Click()
    7.         WebBrowser1.Navigate("http://sfront.ijji.com")
    8.         lblstatus.Text = "Connecting to IJJI Soldier Front...."
    9.     End Sub
    10.     Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, ByVal URL As Object)
    11.         If URL = "http://sfront.ijji.com" Then
    12.             WebBrowser1.Document.All("UserID").InnerHtml = user.Text
    13.             WebBrowser1.Document.All("Password").InnerHtml = pass.Text
    14.             WebBrowser1.Document.All("Sign In").Click()
    15.  
    16.         End If
    17.  
    18.  
    19.  
    20.     End Sub
    21.  
    22. End Class

    and the only error i get is this:
    Error 1 'Public Event Click(sender As Object, e As System.Windows.Forms.HtmlElementEventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event. C:\Users\Filip\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 14 13 WindowsApplication1

    please help

  34. #394

    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 believe you need to use InvokeMember() to call click on a button like you are trying to do:

    Something like:

    Code:
    webbrowser1.Document.All("Sign In").InvokeMember("click")
    If that doesn't work try, "Click" or "click()", but I am pretty sure it is the one in the above code block.

  35. #395

    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

    Quote Originally Posted by bl34ch127
    Hello, I am trying to autofill a form that has no name or id. There are two forms on the page; the first is hidden while the second is the only visible form.

    The visible form is a captcha and I have my COM webbrowser setup so that when it finds a captcha it asks for user input using inputbox()

    I have tried countless different ways but I CANNOT find out how to fill the captcha form. Form some reason it refuses to fill.

    Please help, oh and if needed I can supply my code and the html I am trying to use it on
    I can't help you with bypassing a captcha.. The point of the code I provided is for automating websites that permit it. captcha is an obvious sign of a page that should NOT be automated.

  36. #396
    New Member
    Join Date
    Apr 2009
    Posts
    5

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

    hai.., how can i fill textbox inside frame? i had arround searching for this..,but still no result
    thx before.

  37. #397

    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 try looking through the past pages of this thread. I am pretty sure frame access was discussed at some point.

  38. #398
    Member
    Join Date
    Jul 2008
    Posts
    42

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

    Quote Originally Posted by kleinma View Post
    I can't help you with bypassing a captcha.. The point of the code I provided is for automating websites that permit it. captcha is an obvious sign of a page that should NOT be automated.
    The user will still be watched the page and inputting the captcha manually. I just want to fill the textbox!

  39. #399
    New Member
    Join Date
    Apr 2009
    Posts
    4

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

    nvm ^^
    Last edited by Sjors; Apr 22nd, 2009 at 09:03 AM.

  40. #400
    New Member
    Join Date
    Apr 2009
    Posts
    4

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

    Found out how to check the first radio button:

    Code:
    WebBrowser1.Document.GetElementsByTagName("Input").Item(0).SetAttribute("checked", "checked")

Page 10 of 14 FirstFirst ... 78910111213 ... 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