I've been attempting to extract data from a website node that includes JavaScript. In VB .NET, the code I typically use is as follows:
Dim listSpan As IHTMLElementCollection = bodyel.getElementsByTagName("span")
For Each spanItem As IHTMLElement In listSpan
If spanItem.className & "" = "span_name" Then
If Not spanItem.innerText Is Nothing Then
str_result = spanItem.innerText.ToString
Console.WriteLine("Found it: " & str_result)
Else
str_result = "NO"
Console.WriteLine("Not Found")
Console.Beep(500, 500)
End If
End If
Next
However, I am struggling to adapt this code to function within an Android service (Java).
I experimented with Jsoup, but it only captures the elements in the "view source code" and not the JavaScript-generated content in HTML.
try {
Document doc = Jsoup.connect(str_link).get();
Elements links = doc.select("span_name");
for(Element link : links) {
String result = link.text();
Log.d("TMA Service","result: " + result);
list.add(title);
}
}
Basically, the VB code is able to uncover all the information similar to when right-clicking on an element in Google Chrome and choosing "Inspect Element." This reveals everything, and I am looking for a way to access this data via Android.
Could someone provide me with an example?
Thank you.