Results 1 to 7 of 7

Thread: How to add text to a textbox in webbrowser control with random identifiers

  1. #1

    Thread Starter
    Addicted Member SavedByGrace's Avatar
    Join Date
    May 2006
    Posts
    130

    Arrow How to add text to a textbox in webbrowser control with random identifiers

    Hi all,
    I am attempting to send a string to a textbox in the webbrowser control and the page I am trying to do this with has random name= and value= fields which makes it difficult to use the typical methods for placing text in the textbox. I have spent quite a bit of time searching and attempting to figure this out and I'm stumped. Any help would be appreciated.


    Example:
    Code:
    <span class="req">Example Textbox:</span><br>
    <input type="hidden" class="point" name="U2FsdGVkX18xODA2MDE4MAtiYv1QcVMTlaG1QZmsXCTFDSbneXPOpDDkdDv9KIygapaXLEwrDHg" value="U2FsdGVkX18xODA2MDE4MDvLMJlAuWhymddirLsfDt0Aa9Jm75TdDlce-wM9zO3MGNI9f8JXHW4">
    <input class="req" tabindex="1" type="text"
    name="U2FsdGVkX18xODA2MDE4MMZfVR2sB_tOWEzuk6.mCZPmQ:f8kwMmMfDECi8JhBBIrOUSFHBGdffVA"
    id = "U2FsdGVkX18xODA2MDE4MMZfVR2sB_tOWEzuk6.mCZPmQ:f8kwMmMfDECi8JhBBIrOUSFHBGdffVA"
    size="30" maxlength="70"
    value="">

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: How to add text to a textbox in webbrowser control with random identifiers

    Does the name changes from time. I wont Agree..Check and comeback
    Please mark you thread resolved using the Thread Tools as shown

  3. #3

    Thread Starter
    Addicted Member SavedByGrace's Avatar
    Join Date
    May 2006
    Posts
    130

    Re: How to add text to a textbox in webbrowser control with random identifiers

    Quote Originally Posted by danasegarane View Post
    Does the name changes from time. I wont Agree..Check and comeback

    Yes it does change,
    For example, below is how it appears in the browser source after i cleared my cache, cookies, etc. and refreshed the page just moments ago:

    Code:
    <span class="req">Example Textbox 2:</span><br>
    <input class="req" tabindex="1" type="text"
    name="U2FsdGVkX18xNTEwMT.E1MZ0XrzLLUQqnK45.gQiX7W.N5BlwtuZzcfpIunlXaoMnV0tNg2ClSIuzA"
    id = "U2FsdGVkX18xNTEwMT.E1MZ0XrzLLUQqnK45.gQiX7W.N5BlwtuZzcfpIunlXaoMnV0tNg2ClSIuzA"
    size="30" maxlength="70"
    value="">

  4. #4
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: How to add text to a textbox in webbrowser control with random identifiers

    Post the Website Link..
    Please mark you thread resolved using the Thread Tools as shown

  5. #5

    Thread Starter
    Addicted Member SavedByGrace's Avatar
    Join Date
    May 2006
    Posts
    130

    Re: How to add text to a textbox in webbrowser control with random identifiers

    Quote Originally Posted by danasegarane View Post
    Post the Website Link..
    I have sent you a PM with the link. Thanks.

  6. #6

    Thread Starter
    Addicted Member SavedByGrace's Avatar
    Join Date
    May 2006
    Posts
    130

    Re: How to add text to a textbox in webbrowser control with random identifiers

    does anyone else have any suggestions or tips?

  7. #7

    Thread Starter
    Addicted Member SavedByGrace's Avatar
    Join Date
    May 2006
    Posts
    130

    Re: How to add text to a textbox in webbrowser control with random identifiers

    I wasn't able to get the answer I was looking for here, but I did come up with a rough work around by parsing out the name which may be helpful to someone else with the same issue, So, I'm posting it below. If someone knows of a better way, please post it here:


    Code:
    TmpData = WB1.DocumentText.ToString
    tmp1 = Mid(TmpData, InStr(TmpData, "Example Textbox 1:") + 19)
    tmp1 = Mid(tmp1, InStr(tmp1, "tabindex=") + 10)
    tmp1 = Mid(tmp1, InStr(tmp1, "name=") + 6)
    tmp1 = Microsoft.VisualBasic.Left(tmp1, InStr(tmp1, """") - 1)
    WB1.Document.Forms("postingForm").All(tmp1).SetAttribute("value", "Example text")
    Last edited by SavedByGrace; Nov 28th, 2009 at 12:39 PM. Reason: correcting spelling typos

Tags for this Thread

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