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="">
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
Re: How to add text to a textbox in webbrowser control with random identifiers
Quote:
Originally Posted by
danasegarane
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="">
Re: How to add text to a textbox in webbrowser control with random identifiers
Re: How to add text to a textbox in webbrowser control with random identifiers
Quote:
Originally Posted by
danasegarane
Post the Website Link..
I have sent you a PM with the link. Thanks.
Re: How to add text to a textbox in webbrowser control with random identifiers
does anyone else have any suggestions or tips?
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")