currentElement.GetAttribute(VB.NET)
-
I am trying to retrieve a value within a textbox that has a vlue already passed to it within a webpage. As you can see I am trying to extract the last name here(red fire truck:
<span id="CallerForm1_CallerInformation1_lblLNameLabel" class="clsFormLabelSide" style="font-size:XX-Small;z-index: 109; left: 273px; position: absolute;
top: 56px">(last)</span>
<input name="CallerForm1:CallerInformation1:txtLName" type="text" value="RedFireTruck" maxlength="50" id="CallerForm1_CallerInformation1_txtLName" style="width:168px;z-index: 105; left: 266px; position: absolute;
top: 72px" />What I have been using is the chunk within the methos: Document Completed. Im trying to store its value in a variable so I can pass the var to the next screen or a different page. All I could come up with was this. keep in mind I am using a msgbox to see if anything has been saved or retrieved by so far I havent gotten any notifications:
Dim theElementCollection As HtmlElementCollection = wbCHCTrac.Document.GetElementsByTagName("input")
If wbCHCTrac.Url.ToString.Contains("client/upd_caller.aspx?") Then
For Each currentElement As HtmlElement In theElementCollection
Dim controlName As String = currentElement.GetAttribute("id").ToString
If controlName = "CallerForm1:CallerInformation1:txtLName" Then
MsgBox(currentElement.GetAttribute("Value").ToString)End If Next End If
Any help would be appreciated =)
-
I am trying to retrieve a value within a textbox that has a vlue already passed to it within a webpage. As you can see I am trying to extract the last name here(red fire truck:
<span id="CallerForm1_CallerInformation1_lblLNameLabel" class="clsFormLabelSide" style="font-size:XX-Small;z-index: 109; left: 273px; position: absolute;
top: 56px">(last)</span>
<input name="CallerForm1:CallerInformation1:txtLName" type="text" value="RedFireTruck" maxlength="50" id="CallerForm1_CallerInformation1_txtLName" style="width:168px;z-index: 105; left: 266px; position: absolute;
top: 72px" />What I have been using is the chunk within the methos: Document Completed. Im trying to store its value in a variable so I can pass the var to the next screen or a different page. All I could come up with was this. keep in mind I am using a msgbox to see if anything has been saved or retrieved by so far I havent gotten any notifications:
Dim theElementCollection As HtmlElementCollection = wbCHCTrac.Document.GetElementsByTagName("input")
If wbCHCTrac.Url.ToString.Contains("client/upd_caller.aspx?") Then
For Each currentElement As HtmlElement In theElementCollection
Dim controlName As String = currentElement.GetAttribute("id").ToString
If controlName = "CallerForm1:CallerInformation1:txtLName" Then
MsgBox(currentElement.GetAttribute("Value").ToString)End If Next End If
Any help would be appreciated =)
I am probably stating the obvious, but I presume you have at some stage determined whether the DocumentCompleted handler is ven getting fired, and if so whether execution is ever going within the first If statement? And am I missing something.. your html has ...
id="CallerForm1_CallerInformation1_txtLName"
but then you're looking for an id ""CallerForm1:CallerInformation1:txtLName" (colon, not underscore)
Dim controlName As String = currentElement.GetAttribute("id").ToString If controlName = "CallerForm1:CallerInformation1**:**txtLName" Then
Shouldn't that be..
Dim controlName As String = currentElement.GetAttribute("id").ToString If controlName = "CallerForm1\_CallerInformation1**\_**txtLName" Then