Results 1 to 21 of 21

Thread: How to send text to a textbox in a webbrowser w/out using sendkeys (input type=file)?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269

    How to send text to a textbox in a webbrowser w/out using sendkeys (input type=file)?

    apparantly, its impossible to set the value of a <input type=file> element in a webbrowser..

    anyone know how to set text to elements like this without using sendkeys (ie WM_SETTEXT).. how would i figure out the elements hwnd?
    Last edited by VaxoP; Aug 26th, 2004 at 01:35 AM.

  2. #2
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424
    i dont know will this help u but u should check it out.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269
    doesnt help..

  4. #4
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    There have been multiple posts about things like this in the past. Mostly from a user called EJ12N, and I believe he found the answer and posted it. It has something to do with the Document Object Model... Try searching..

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269
    http://www.vbforums.com/showthread.p...ghlight=object

    might be what youre referring to. otherwise i cant find anything :/

    but that post doesnt answer the question

  6. #6
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    Originally posted by «°°phReAk°°»
    There have been multiple posts about things like this in the past. Mostly from a user called EJ12N, and I believe he found the answer and posted it. It has something to do with the Document Object Model... Try searching..

    Phreak
    you remembered me

    anyways...like phreak said use DOM...

    With WebBrowser1.Document
    .getElementById("email").Value = sEmail
    End With

    That will set the element with name email in this case was a textbox with the value or variable sEmail
    Hope that helps
    Born to help others
    (If I've been helpful then please rate my post. Thanks)

    call me EJ or be slapped!

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269
    thanks, but that wont work

    input type=file elements cannot have their value set that way..

    the only thing that has worked in the past was sendkeys, but that requires app focus...

    is there another way?

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269
    bump

  9. #9
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    Do it with javascript

    ie.Navigate "javascript:document.write('<html><body><input type=file id=txtFile></body></html>');"

    ie.Navigate "javascript:document.write('<html><body><input type=password id=txtPass></body></html>');"

    ie.Navigate "javascript:document.write('<html><body><input type=text id=txtName></body></html>');"

    Hope that's what you mean
    Born to help others
    (If I've been helpful then please rate my post. Thanks)

    call me EJ or be slapped!

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269
    i need to set the value of them, not create them

    ie.

    <input type=file name=something>

    how can i set the value of this element? you cannot do it with the DOM

  11. #11
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    how can i set the value of this element? you cannot do it with the DOM
    How you do it in HTML i 4got post it here then i might be able to solve it ...
    Born to help others
    (If I've been helpful then please rate my post. Thanks)

    call me EJ or be slapped!

  12. #12

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269
    with dom it would be

    wb.document.forms(0).something.value = "whatever"

    but you cannot set the value of input type=file with DOM

  13. #13
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    Originally posted by VaxoP
    with dom it would be

    wb.document.forms(0).something.value = "whatever"

    but you cannot set the value of input type=file with DOM
    No i want raw HTML how you do it...
    what value you want to change ?... -.-
    you just said change value of type=file but what value i changed type= value in above post... to other value else tell what value u want to change....
    Born to help others
    (If I've been helpful then please rate my post. Thanks)

    call me EJ or be slapped!

  14. #14

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269
    i need to know in general..

    it is impossible to set the value of input type=file with dom

    impossible.

    doesnt matter how big the box is, no matter what style it has, or its name

    ALL input type=file cannot have their value set by DOM..

    i need to know how to set their value without using DOM, without using sendkeys

  15. #15
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    People, people, people..... 1) I don't think it can be done. It's a security thing. Prevents people for using hidden file tags to upload files w/o the user knowing. Bad juju. 2) If some one does figure out how to do it, please post your web site, I want to mark it on my list of places to never visit.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  16. #16
    Hyperactive Member Vishalgiri's Avatar
    Join Date
    Oct 2003
    Location
    India
    Posts
    345
    a software named "Gator" enters username password all my personal info when ever a form appers in web browser, i think this theread is like that
    Regards,
    Vishalgiri Goswami
    Gujarat, ( INDIA ).
    ---------------------

  17. #17

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269
    gator fills input type = 'anything BUT file'

    i dont want to do this with HTML, i am aware MS has purposely made it so you cannot set the value of the element.

    i dont want to do this with DOM either, as it probably cannot be done.

    but there MUST be a way to do it with api??

    i mean theres a very simple way..

    wb.document.forms(0).element_file.focus
    sendkeys whatever

    but that requires focus to the app.. isnt there ANY other way?

  18. #18

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269
    bump

  19. #19

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269
    ^^;

  20. #20

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269
    bump

  21. #21
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    Bumper...have fun
    The Bump Thread
    Born to help others
    (If I've been helpful then please rate my post. Thanks)

    call me EJ or be slapped!

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