I have a VB.NET WinForms application. I am using a webview2 control as a web browser. Actually I don't need to make general browsing, rather I just need to open Google maps, then enter two locations, and then get the Google map distance between both locations that I entered. But although my webview2 control shows the complete Google map and the user can get the path between any two locations as shown in the picture:

But there is a problem: I need to fetch three values out from the webview2 control and show them in three separate text boxes, i.e.
Location1: (In string format)
Location2: (In string format)
Distance: 7.2km (In numeric format)
I need these three values to show them in separate text boxes and then further I need to save these three values in a database.
I developed this application for a transportation company and the three values explained above will make a complete transportation route.
Do I need to use any other control instead of webview2 to fulfill my need?
I think I have cleared what I need in fact.
If anyone can help in this regard, I will be very very grateful.
Imports System.Text
Imports Microsoft.Web.WebView2.Core
Private Sub txtSearc_KeyDown(sender As Object, e As KeyEventArgs) Handles txtSearch.KeyDown
If e.KeyCode = Keys.Enter Then
Try
Dim queryaddress As New System.Text.StringBuilder
queryaddress.Append("https://www.google.com/maps?q=")
If txtSearch.Text <> "" Then
queryaddress.Append(txtSearch.Text + "," & "+")
End If
MyWebView_.CoreWebView2.Navigate(txtSearch.Text)
Catch ex As Exception
Exit Sub
End Try
End If
End Sub
This is the perfect case where you should use an API rather than doing web-scraping (as you do right now). Google Maps can change its UI at any time, which would break your web-scraping approach. Also, the UI is made to be human-readable rather than being machine-readable (which makes it difficult to parse for machines).
Instead, you should use the Google Maps Routes API. Your application can talk to Google Maps directly, and Google will tell you all the info you need in a machine-readable form. The downside of course is that you need to pay Google per API-request, but since you seem to create a commercial product, you could forward that cost to your customer.
(Note: I am not affiliated with Google in any way.)