Retrieving data from an edge browser window

wackywoo105

Registered User.
Local time
Today, 15:54
Joined
Mar 14, 2014
Messages
208
I'm trying to retrieve the value of this element, but I can't figure out how.

Code:
<input autocomplete="off" class="form-control w84 h25 display-inline-block" id="SupplierModel_TotalClaimForGlassesOrContactLenses" maxlength="6" name="SupplierModel.TotalClaimForGlassesOrContactLenses" placeholder="£ 0.00" readonly="readonly" style="text-align:right" type="text" value="">

I've tried this but it doesn't work:

Code:
Debug.Print Me.EdgeBrowser0.ExecuteJavascript; "document.getElementById('SupplierModel.TotalClaimForGlassesOrContactLenses').value"

Can anyone please help?

Screenshot 2026-01-08 104252.png


Screenshot 2026-01-08 104328.png
 
Code:
Debug.Print Me.EdgeBrowser0.ExecuteJavascript; "document.getElementById('SupplierModel.TotalClaimForGlassesOrContactLenses').value"
                                                                                      ^
                                                                                      |
                                                                        The id of the input has an
                                                                        underscore (_) here, not a
                                                                        dot (.)
 
Code:
Debug.Print Me.EdgeBrowser0.ExecuteJavascript; "document.getElementById('SupplierModel.TotalClaimForGlassesOrContactLenses').value"
                                                                                      ^
                                                                                      |
                                                                        The id of the input has an
                                                                        underscore (_) here, not a
                                                                        dot (.)
Sorry. I did actually try with the underscore. that was just an error in typing out the question. I get this:

Screenshot 2026-01-08 111615.png


Screenshot 2026-01-08 111633.png
 
it must be a function rather than a sub.

try:
Code:
Debug.Print Me.EdgeBrowser0.ExecuteJavascript("document.getElementById('SupplierModel_TotalClaimForGlassesOrContactLenses').value")
 
Are you sure that you are using the correct function for the job?

EdgeBrowser control docs

I think you might actually need RetrieveJavascriptValue instead.

What happens if you try:
Code:
Dim JStoExecute As String, result As String

JStoExecute = "document.getElementById('SupplierModel_TotalClaimForGlassesOrContactLenses').value"
result = Me.EdgeBrowser0.RetrieveJavascriptValue(JStoExecute)
Debug.Print result
 
If the above fails, you can also try adjusting JStoExecute to be a function:
Code:
' ...
JStoExecute = "() => document.getElementById('SupplierModel_TotalClaimForGlassesOrContactLenses').value"
' ...
 
Are you sure that you are using the correct function for the job?

EdgeBrowser control docs

I think you might actually need RetrieveJavascriptValue instead.

What happens if you try:
Code:
Dim JStoExecute As String, result As String

JStoExecute = "document.getElementById('SupplierModel_TotalClaimForGlassesOrContactLenses').value"
result = Me.EdgeBrowser0.RetrieveJavascriptValue(JStoExecute)
Debug.Print result

Many thanks. That works.
 

Users who are viewing this thread

Back
Top Bottom