Page 3 of 13 FirstFirst 123456 ... LastLast
Results 81 to 120 of 531

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

Hybrid View

  1. #1
    New Member
    Join Date
    Dec 2006
    Posts
    6

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

    I will try to PM the source code tonight or tomorrow, but please, do not share... Just take what you need.

    I also found something interresting; you cannot grab value of a textbox with property visible = false...

    Thanks,
    Pass

  2. #2

    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

    do you mean an ASP.NET textbox with visible set to false? If so, that is because ASP.NET simply doesn't even render HTML for it when its not visible.

    If you are talking about a regular <input type=text> tag, then visible isn't a valid HTML property of the tag anyway.

    Also, I don't need your whole source, I just need a sample HTML page with frames in it, so I can test grabbing data in the frames. If you provide one, I will take a look at it and try to provide an answer.

  3. #3
    New Member
    Join Date
    Jan 2007
    Posts
    10

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

    Hello sir,

    I am new member to this forum.
    I have one doubt in vb.net 2005.
    How to set the file upload element value using web browser control?.
    Thank you for advance.

    Regards,
    Subu

  4. #4
    New Member
    Join Date
    Jan 2007
    Posts
    10

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

    I am tried using setattribute and other command in .net 2005 but i can set the value of file upload element but i am trying send key to set the value but this is very slow.
    There is anyother solution?.

  5. #5
    New Member
    Join Date
    Jan 2001
    Posts
    1

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

    I have a newbie question that hopefully the experts here can answer quickly without me being too much of a nuisance. In the past, I have created simple apps to fill in username and password fields using the webbrowser control in VB.

    However, now I am trying to get past a page that implements frames, one of which contains the username and password fields in question. For some reason the method I have used in the past (with varying field names, obviously), namely:

    With wWeb.Document
    .All("username").Value = "loginid"
    .All("password").Value = "pword"
    .getElementById("Submit").Click
    End With


    doesn't work with frames. The web page in question will not let me navigate just to the frame that I need (probably for security reasons).

    My questions are:

    1. Can anyone point me to where I can get some documentation for what properties and methods can be used under the Document property (i.e. some documentation on WebBrowser.Document.GetElementById or WebBrowser.Document.GetElementByName or WebBrowser.Document.Frames(x) or other properties and methods). I can't help but think if I could get to that information I could figure it out.

    2. Can anyone figure out how I should modify the above code to satisfy this web page --> https://sportal.uspto.gov/authentica...rLocalEPF.html

    I would prefer to use VB6 but also have access to VB.NET 2005.

    Thanks for any help you can render.

  6. #6

    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 am not aware of any easy way to auto fill content within frames.

    I also didn't find anything that looked promising in my searches.

    If I do figure out a way to manipulate content in frames, I will update this example code accordingly

  7. #7
    New Member
    Join Date
    Jul 2006
    Posts
    9

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

    Ok... this should be easy, but I'm having a terrible time...

    kleinma, I've looked over your sample and still can't get this to work:

    All I'm trying to do is fill in the info on the paypal website and log in. The email field is named "login_email", the password field is "login_password", and the submit button is named "submit.x"

    I've scrapped all of my repeated attempts, because I haven't been able to get anything to work.

    I've ended up with this, even though I know it's not exactly how you coded your sample, I ended up straying away because I couldn't get yours to work.

    Code:
            If IsBrowserBusy(WebBrowser1) = False Then
                Dim HTML As HtmlDocument
                Dim HTMLS As mshtml.HTMLInputButtonElement
                HTML = WebBrowser1.Document
                HTML.All.Item("login_email").InnerText = "***"
                HTML.All.Item("login_password").InnerText = "*****"
                HTML.All.Item("submit").Click()
                For Each HTMLS In WebBrowser1.Document.GetElementsByTagName("input")
                    If HTMLS.type = "submit" And HTMLS.value = "Log In" Then
                        HTMLS.click()
                        Exit For
                    End If
                Next
    
    
            End If
    IsBrowserBusy is just a function I made to return whether or not the browser is busy. With this code, the textboxes were filled in, but I can't get it to submit, before even compiling i get this error:

    "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."

    Ugh, this is frustrating! Hopefully you have some time to lend a hand-
    Last edited by coheed; Mar 14th, 2007 at 06:50 AM. Reason: vbcode

  8. #8

    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 use the 2005 webbrowser, and use the InvokeMember() method

    I have attached example code.

    I actually plan on rewriting the original example in this thread using the 2005 webbrowser (even though it still does have some limitations that the COM browser doesn't)

    however it also does have some advantages.

    So anyway take a look at the attached zip file, you will see its only a few lines of code to do a paypal auto login.
    Attached Files Attached Files

  9. #9
    New Member
    Join Date
    Jul 2006
    Posts
    9

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

    Perfect, you're the man!

    Any clue where I can find a good writeup on the 2005 web browser?

  10. #10

    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 its a control that is actually a built in part of the .NET 2.o framework, so a good starting place would be to go through the MSDN help documentation on it. It will list all the properties, methods, events, etc...

  11. #11
    Hyperactive Member
    Join Date
    Feb 2007
    Posts
    332

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

    Sorry for the mistake.
    Last edited by ggodwin; Mar 20th, 2007 at 09:24 AM.

  12. #12

    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

    Sorry but you are using VB6 and IE automation, and all this example code is done with VB.NET, and ActiveX/.NET webbrowser controls.

  13. #13
    New Member
    Join Date
    May 2007
    Posts
    1

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

    Hi fellows,
    i am trying to do a similar stuff and i am very much successful as of yet. I am building a desktop application in C# which will submit form by HttpWebRequest and HttpWebResponse in addition to other functionalities. i came across a problem when i was trying to submit form on a ASP.Net site as it wont yield the page after login. One reason a friend told me was that i was not incorporating ViewState value in the data being sent. Now as i am building a desktop application and i need UrlEncode function of HttpUtility class for converting viewstate value into base64 equivalent(reason being that this representation caters for escape sequences). I cant access this class in a desktop application.
    Can anyone tell me that am i going on right track and if yes what else i need to do.
    ur assistance will be of great help to me.

  14. #14
    New Member
    Join Date
    May 2007
    Posts
    4

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

    I'm using VS2005 and VB.NET, .NET framework 2.0.

    I've read most of this thread... in hopes to be able to "click" on HtmlElements with a WebBrowser, without luck. The issue is I don't want to do this in a windows form app.

    I've tried both the InvokeMember("click") method and the reflections/DomElement, which work fine if the browser is on a Windows Form but just hang and don't do anything in my ASP.NET application (where I instantiate the browser myself).

    I can get the browser to navigate to pages however. I have to be running in a separate thread with ApartmentState STA.

    The AxSHDocVw.AxWebBrowser() ends up throwing this out trying to navigate:
    An unhandled exception of type 'System.Windows.Forms.AxHost.InvalidActiveXStateException' occurred in AxInterop.SHDocVw.DLL

  15. #15

    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

    wait, so what exactly are you trying to do? Invoke your own clicks in an ASP.NET application?

  16. #16
    New Member
    Join Date
    May 2007
    Posts
    4

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

    Yea that's what I need to do. I wouldn't need the WebBrowser object except for javascript use in some pages I'll need to crawl. The dependence on a web browser object doesn't lend itself well to the parallel nature of crawling, but usually httpwebrequest/response is what I'll use.

    We have an old VB6 winform app that is able to do this fine, but in a winform. I'd like to have a sort of independent library that I can choose to use wherever, (asp.net, cmd line, etc). Wanted to use the web browser despite not having one actually visible as it normally would be, and still be able to simulate clicks.
    Last edited by ArmchairAthlete; May 15th, 2007 at 08:52 AM.

  17. #17

    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

    why not just use a winform and put the webbrowser off screen?

  18. #18
    New Member
    Join Date
    May 2007
    Posts
    4

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

    I want to be able to do this from within an ASP.NET application.

    Now I'm down to just wondering if I should have the web app start off an exe webform app and communicate with it somehow... probably not worth it.

    Is there no other way besides these WebBrowser objects to deal with executing javascript that does whatever and eventually takes me to another page? Without writing a javascript interpreter or something, hah.

  19. #19
    New Member
    Join Date
    May 2007
    Posts
    4

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

    Nice, I can do .Navigate and have the URL string just be the javascript in the link instead (with the .NET System.Windows.Forms.WebBrowser wrapper).

    Now to get this to work with buttons... some pages have onclick javascript that goes off, then expect the normal button's form submit on click to happen afterwards it seems.

    Edit: well, that works with some javascript and even some I make up to .click() something in the DOM, but hangs with other js like described above.
    Last edited by ArmchairAthlete; May 18th, 2007 at 08:38 AM.

  20. #20
    New Member
    Join Date
    Jan 2011
    Posts
    2

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

    Thanks very much for the info on this thread. I have learned much since finding it. Below is a line of HTML found in the current webpage that is giving me no small amount of 'heardburh'.
    This line appears as the third (i think .item(2)) of the page. I am trying to invoke using 'click' as you do, but this is not a button. When rendered in the webbrowser control it appears to be a submit button, but, as you see, it is not.

    (HTML element:

    <input type="image" name="loginPrimeAccess" src="/images/btn_go_to_primeaccess_BEC0C2.gif" border="0" tabindex="3"><br>

    In the code below I have commented out the TRY in order to see the error message.
    Here is the code I have so far:

    Dim s As IHTMLElement

    Me.Browser.Document.GetElementsByTagName("Input").Item(0).SetAttribute("Value", "037882")
    Me.Browser.Document.GetElementsByTagName("Input").Item(1).SetAttribute("Value", "atrium")
    s = Me.Browser.Document.GetElementsByTagName("image").Item(1)
    'Try

    Me.Browser.Document.GetElementsByTagName("image").Item(2).InvokeMember("Click")
    'Catch
    'End Try

    How can I get the login to go?
    Thanks,
    Gary

  21. #21
    Lively Member
    Join Date
    Apr 2010
    Posts
    73

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

    Quote Originally Posted by paxmanhorn9 View Post
    Thanks very much for the info on this thread. I have learned much since finding it. Below is a line of HTML found in the current webpage that is giving me no small amount of 'heardburh'.
    This line appears as the third (i think .item(2)) of the page. I am trying to invoke using 'click' as you do, but this is not a button. When rendered in the webbrowser control it appears to be a submit button, but, as you see, it is not.

    (HTML element:

    <input type="image" name="loginPrimeAccess" src="/images/btn_go_to_primeaccess_BEC0C2.gif" border="0" tabindex="3"><br>

    In the code below I have commented out the TRY in order to see the error message.
    Here is the code I have so far:

    Dim s As IHTMLElement

    Me.Browser.Document.GetElementsByTagName("Input").Item(0).SetAttribute("Value", "037882")
    Me.Browser.Document.GetElementsByTagName("Input").Item(1).SetAttribute("Value", "atrium")
    s = Me.Browser.Document.GetElementsByTagName("image").Item(1)
    'Try

    Me.Browser.Document.GetElementsByTagName("image").Item(2).InvokeMember("Click")
    'Catch
    'End Try

    How can I get the login to go?
    Thanks,
    Gary

    Hi Gary,

    Im glad you have found this thread useful, would you be able to tell me what Webpage your trying to login to so i can take a better look?

    Thanks

  22. #22
    New Member
    Join Date
    Jan 2011
    Posts
    2

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

    The site is www.MyMls.com
    Thanks,
    Gary

  23. #23

    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 should NOT need a pay version of Visual Studio to get the code to work. However perhaps if you can list (some) of the errors, I could point you in the right direction to get it fixed.

  24. #24
    New Member
    Join Date
    Jun 2007
    Posts
    7

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

    as requested:
    All I can debug is that my Vb 2005 Express does not know "mshtml"
    Looking fwd to your reply
    Thanks //Gibbo

    Discription Line Column
    Error 1 Type 'mshtml.HTMLDocument' is not defined. 85 22
    Error 2 Type 'mshtml.IHTMLTxtRange' is not defined. 86 24
    Error 3 Type 'mshtml.IHTMLTxtRange' is not defined. 87 61
    Error 4 Type 'mshtml.HTMLDocument' is not defined. 99 44
    Error 5 Type 'mshtml.HTMLDocument' is not defined. 101 44
    Error 6 Type 'mshtml.HTMLFormElement' is not defined. 110 45
    Error 7 Type 'mshtml.HTMLFormElement' is not defined. 113 67
    Error 8 Type 'mshtml.HTMLInputElement' is not defined. 129 54
    Error 9 Type 'mshtml.HTMLInputElement' is not defined. 133 85
    Error 10 Type 'mshtml.HTMLTextAreaElement' is not defined. 138 55
    Error 11 Type 'mshtml.HTMLTextAreaElement' is not defined.142 86
    Error 12 Type 'mshtml.HTMLOptionButtonElement' is not defined 148 67
    Error 13 Type 'mshtml.HTMLOptionButtonElement' is not defined. 150 67
    Error 14 Type 'mshtml.HTMLButtonElement' is not defined. 156 61
    Error 15 Type 'mshtml.HTMLButtonElement' is not defined. 162 62
    Error 16 Type 'mshtml.HTMLAnchorElement' is not defined. 176 28
    Error 17 Type 'mshtml.HTMLDivElement' is not defined. 186 22
    Error 18 Type 'mshtml.HTMLImg' is not defined. 225 28
    Error 19 Type 'mshtml.HTMLImg' is not defined. 229 73
    Error 20 Type 'mshtml.HTMLSelectElement' is not defined. 242 28
    Error 21 Type 'mshtml.HTMLInputElement' is not defined. 250 31
    Warning 22 The referenced component 'Microsoft.mshtml' could not be found.

  25. #25

    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

    looks like the only problem is you don't have the needed microsoft.mshtml.dll file which is the parsing engine.

    On my PC it is located at
    C:\program files\microsoft.net\primary interop assemblies\Microsoft.mshtml.dll

    Search your PC and see if you have it. If you find it, add a reference to it in the "Add Reference" dialog, and the errors will go away.

    Let me know if you don't have it and I could probably upload it.

  26. #26
    New Member
    Join Date
    Jun 2007
    Posts
    7

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

    You hit the nail on the head. The file is missing, no where to be found on C:drive... you can e-mail to [email protected]

  27. #27

    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

    microsoft.mshtml.dll

    Here you go. I will leave it available on that server for a little while until I know you have gotten it.
    Last edited by kleinma; Sep 10th, 2008 at 09:07 AM.

  28. #28
    New Member
    Join Date
    Jun 2007
    Posts
    7

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

    Thxs, I have download the file, file has been copied into the same location as yours. Problem persist. I have attempted to enter path in the "add reference" dialog as you have recommended. But it is not allowing me to enter the value. Any suggestions…sorry for the inconvenience

  29. #29
    New Member
    Join Date
    Jun 2007
    Posts
    7

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

    sorry found the problem thxs. please ignore my last message

  30. #30
    New Member
    Join Date
    Jun 2007
    Posts
    7

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

    I need to ask the biggest favour ever. I have been researching the web for the last 14 days for a specific script. It appears that you seem to know what your are talking about, thus you may have the answer I seek. Therefore I need your advice and/or direction.

    Objective
    1. Open a http and/or https website
    2. Wait until the page has completely finish downloading (e.g. done) before keystrokes "username" then "TAB" then "password" then "TAB" then "Click".

    Please note:
    1 The problem is that I move about and thus am connected to varying internet speeds. "Wait" and "sleep" commands are unstable.
    2. Other sessions of browsers are already open. Thus the keystroke must be directed to the specific browser window.
    3. Plus the individual characters in the "username" or "password" are echoing. Which brings me to the next problem but is related. Slow down the keystrokes, such that the next keystroke will not occur until the script receives a reply from server acknowledges the previous keystroke. Again “wait” and “sleep” are unstable.
    4. Please note that use of cookies is not an option as the website that I access issue new cookies every time I log on.

    In summary
    I need to slow the script down between WebPages and keystrokes. The script steps thru as it receives acknowledgements from server

    Thankyou
    //Gibbo

    P.S. your programme is great

  31. #31

    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

    Glad to hear you got it working.

  32. #32

    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 are you planning on making a windows forms app in VB.NET that will host a webbrowser control? If so then this sounds easy to do. If you are actually trying to automate an external instance of internet explorer, then that will be more difficult. I know you used to be able to create external instances of IE and automate them, but I think support for that has dropped.

    Anyway, so if you wanted to make a windows app that hosts the browser control (which is what my example code does) then here are a few key points to keep in mind:

    When you navigate to a page, you need to wait for the DocumentCompleted event to fire. This event fires when the page has been fully loaded in the browser. Unlike the navigated event which fires as soon as a navigation has started.

    You don't need to send tabs and keystrokes to the webpage when you use the methods shown in my example code. You simply access the pages DOM (document object model) and fill in the needed fields, and click the needed buttons/links.

    The only one of your points I am not sure of is number 3? What do you mean by echoing? Does the page post back to the server on every keystroke entered? Is that why you need the wait?

  33. #33
    New Member
    Join Date
    Jun 2007
    Posts
    7

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

    I have created a form with buttons to activate individual scripts. Simply I have to log onto many different secure websites at the same time in order to perform different task as part of my employment. Remembering all my usernames and passwords, plus constantly logging on and off website is frustrating. Hence the Form I am creating. Eventually as my experience and knowledge improves. I would like to auto fill the from on these websites from a database, as a lot of my work is repetitive.

    The echoing. The script only has "a" as a keystroke followed by a wait of 500ms before the next keystroke. But the username field may display multiple "a". But this problem does not seem to occur when I am connect to a high speed broadband.

    If you are able to provide a basic code to which I can model from and/or improve it would be much appreciated

    It is now 0200hrs here in Aussie, Thus I must get some shut eye

    Thanks
    //Gibbo

  34. #34
    New Member
    Join Date
    Jun 2007
    Posts
    8

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

    Hi guys. I've read throught this whole thread and I'm hoping you can help me. What I'm trying to do is automate a batch load process we have for our case tracking system. Basicily we have a website internal to our company that we go to and input the filename. You then click submit and it's done.

    So I downloaded the OP's webmanipulate program and got it work well. But when I tried to use the code into my project, it didn't seem to work. It kept getting a repeating error of sorts. So I tried other methods mentioned on this page. The only method I got to somewhat work is:

    Browser.Document.Forms(0).GetElementsByTagName("Input").Item(0).SetAttribute("Value", "test1")

    The result of this is that it puts "test1" is put into a text box, but not the right one. I tried adjusting the Item number but it didn't work. I could only get it to put the text in the top text box (which is a search bar thats a standard part of our company's intranet).

    So here's the html code for the page which I got permission to post with some editions:
    Code:
     
    
    
    <html>
        <head>
            <title>Merckury Batch Load Upload Page</title>
            <script type="text/javascript">			
            var portallastmod='3 Mar 2005'
            var portalcontact='[email protected]'
    </script>
    	
            <meta name="Language" content="English language" />
            <meta name="Sensitivity_class" content="Business confidential" />
    	
            <script src="/scripts/wrapperadd.js" type="text/javascript"></script>
            <script src="/scripts/portaldefaults.js" type="text/javascript"></script>
    
            <link href="/merckury/styles/batchload.css" rel="stylesheet" type="text/css">
        </head>
     
        <body>
    
            <!-- This is the include for the header -->
            <script type="text/javascript">portalInsertHeader()</script>
    		<!-- Begin Breadcrumb Strip -->
    		<div class="portalbreadcrumb">
    			<a href="http://my.merck.com/index.jsp?epi-content=myMerckRedirectType&amp;epi-process=home_redirect.jsp">myMerck home</a> &gt; 
    			batch load cases
    		</div>
    		<!-- End Breadcrumb Strip -->
            <div id="pagecontent">
    
                <br/>
                <br/>
    
                <form name="fileUploadForm" method="post" action="/merckury/batchFileUploadRequest" ENCTYPE="multipart/form-data" >
                <table width='600' border='0' cellpadding="1" cellspacing="1" align="center" bgcolor="#666666">
    				<tr>
    					<th>
    						Merckury Batch Load Upload Page    
    					</th>
    				</tr>
                    <tr>
                        <td>
                            <table width="100%" cellpadding="5" cellspacing="0" border="0" bgcolor="white">
                                <tr>
                                    <td>
                                    
                                        <br/>
                                        File Name: <input type="file" name="file1" size="80" />
                                        <br/>
                                        <br/>
                
                                        <div align="center">
    										<input type="submit" name="submitButton" value="Submit"/>
    									</div>
    
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    
                                        <a href="BatchLoad.xls">Get the batch load spreadsheet</a>
    
                                    </td>
                                </tr>
    						</table>
                        </td>
                    </tr>
                </table>
                </form>
                <table width='600' border='0' cellpadding="1" cellspacing="1" align="center" bgcolor="#666666">
    				<tr>
    					<th>
    						Look up ID Values    
    					</th>
    				</tr>
                    <tr>
                        <td>
                            <table width="100%" cellpadding="5" cellspacing="0" border="0" bgcolor="white">
    							<tr>
    								<td>
    								&nbsp;&nbsp;<a href="/merckury/batchIdLookup?lookuptype=0">Product IDs</a><br>
    								&nbsp;&nbsp;<a href="/merckury/batchIdLookup?lookuptype=1">Category / Specialty Type / Detail IDs</a><br>
    								&nbsp;&nbsp;<a href="/merckury/batchIdLookup?lookuptype=4">Provider Group IDs</a><br>
    								&nbsp;&nbsp;<a href="/merckury/batchIdLookup?lookuptype=5">Attribute IDs</a><br>
    								<br>
    
    								</td>
                                </tr>
    
    						</table>
                        </td>
                    </tr>
                </table>
    
    
    
            </div>
            <script type="text/javascript">portalInsertFooter()</script>
    
        </body>
    </html>
    As I said before I'm justing trying to input the filename (which is standard) and then click submit. My project has a browser in it called "browser" that navigates to the website when the form is loaded"

    Also, for future refrence - is there a way to program a scan function to scan a website and display what the item numbers are? So basiclly after going to a website I would hit a "scan" button and it would look at the website and tell me the text boxes and gives me there form and item number. Would be helpful.

    Any suggestions?

    UPDATE: I've went back and modified the browser to use the testpage that came with OP program to see if it can populate any box after the first using the : Browser.Document.Forms(0).GetElementsByTagName("Input").Item(0).SetAttribute("Value", "test1")
    method and ran into the same problem. Even though I added more lines with higher Item number, it just populated the first box (txtbox in this case). Hope someone can help.
    Last edited by roiegat; Jun 27th, 2007 at 09:02 AM.

  35. #35

    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

    It is a security limitation of the IE DOM.

    Imagine you went to some webpage, and the webpage had a file upload input element on it, that was prefilled with some sensitive file from your computer, and when the page loads, javascript has the page automatically submit, and some personal file from your computer is uploaded to someones server....

    For that reason, the Document Object Model does not expose the value property of <input type=file> elements. That means you can not set those via code.

  36. #36
    New Member
    Join Date
    Jun 2007
    Posts
    8

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

    Quote Originally Posted by kleinma
    It is a security limitation of the IE DOM.

    Imagine you went to some webpage, and the webpage had a file upload input element on it, that was prefilled with some sensitive file from your computer, and when the page loads, javascript has the page automatically submit, and some personal file from your computer is uploaded to someones server....

    For that reason, the Document Object Model does not expose the value property of <input type=file> elements. That means you can not set those via code.
    Guess I set them wrong...just figured out a way. I wrote this handy little sub:

    Private Sub update_text(ByVal field As String, ByVal input_text As String)
    Browser.Document.All(field).Focus()
    SendKeys.Send(input_text)

    End Sub

    So I just send that I want to update "file1" and the text. It sets the focus on the box and then used sendkeys to type in the file name.

    Thanks for the info!

  37. #37

    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, using sendkeys could work because sendkeys mimics user input. Since javascript doesn't have access to sendkeys, there is no direct browser security risk there.

    Just make sure you do extensive testing with sendkeys, as it sends keystrokes to the active window, so you shoudl always make sure the desired window has focus before calling sendkeys

  38. #38
    New Member
    Join Date
    Jun 2007
    Posts
    8

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

    Quote Originally Posted by kleinma
    yeah, using sendkeys could work because sendkeys mimics user input. Since javascript doesn't have access to sendkeys, there is no direct browser security risk there.

    Just make sure you do extensive testing with sendkeys, as it sends keystrokes to the active window, so you shoudl always make sure the desired window has focus before calling sendkeys
    That correct. I learned this the hard way when I was trying to debug the code and the program would hang on me. So I have to put a breakpoint after the sendkey command.

  39. #39
    New Member
    Join Date
    Jun 2007
    Posts
    6

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

    Hi,
    I am a newbie on VB, using VS2005.
    How do I use InvokeMember if the button does not have a name?

    html - <input id="uploadButton" type="submit" value="Upload Video">

    code - wb.Document.Forms("uploadVideoFileForm").InvokeMember("submit") - nothing happens
    wb.Document.Forms("uploadVideoFileForm").InvokeMember(????)


    what do i do? or is there a basic way to go around with this.
    Thanks in Advance!

  40. #40

    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

    instead of using the form specifically, try Invoking a click on the submit button using its ID of "uploadButton"

Page 3 of 13 FirstFirst 123456 ... 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