OnRequestElementValueByName
Interface AntViewDocument
Type: Event
Parameters: String Name String Value Integer Error
Returns: None
Asynchronous result triggered after calling the RequestElementValueByName method.
Name contains the Name of the html element which was requested. Name is case sensitive.
Value holds the value of the first element identified by Name.
Error is 0 when the element was found, or 1 if the element identified by Name was not found.
Example:
Suppose we have the following html:
<form id="login" class="login" action="thankYou.html">
<div class="loginName">
<label for="username">UserName</label>
<input type="text" name="username" placeholder="User Name" required />
</div>
<div class="loginPassword">
<label for="password">Password</label>
<input type="password" name="password" placeholder="Password" required />
</div>
<div class="loginBtn">
<button id="submit" type="submit" name="submit">Login</button>
</div>
</form>
Then in DataFlex run:
Object oReadFormButton is a Button
Set Location to 199 92
Set Label to "Read Form"
Set peAnchors to anBottomLeft
Procedure OnClick
Send ConnectBrowser to oDocument
Send ComRequestElementValueByName of oDocument "username"
Send ComRequestElementValueByName of oDocument "password"
End_Procedure
End_Object
Example in VB6:
Private Sub ReadFormButton_Click()
Document.RequestElementValueByName "username"
Document.RequestElementValueByName "password"
End Sub
Private Sub Document_OnRequestElementValueByName(ByVal Name As String, ByVal Value As String, ByVal Error As Long)
Debug.Print ("Name '" & Name & "' = " & Value)
End Sub
Example:
AntView - The MS Edge WebView2 ActiveX control Date last changed: 04/16/2025