On loading the page, the results tab shows "Status: Router not run" (as detailed on line 323 of the html source). The variable I need is <div id="result_status_complete" .... where the style would be display: inline, instead of display: none.
I have tried this code
B4X:
'Dim Javascript As String="B4A.CallSub('GetVarFromWebview', true, document.getElementById('result_status_complete').getAttribute('style'))"
Dim Javascript As String="B4A.CallSub('GetVarFromWebview', true, document.getElementById('div id='result''))"
WebViewExtras1.executeJavascript(WebView1, Javascript)
Sub GetVarFromWebview(WebVar As String)
'Called when the javascript is finished
Log("Web variable has the value => " & WebVar)
Activity.Finish
End Sub
but the value comes back as empty???? Could this be correct or have I made a mistake. Javascript is not my strength.
The style of the tag is initially "display: none" ie. invisible and changes accordingly. The tag "div id="result_status_complete"" is the one I want and only the style attribute thereof.
Sometimes sleeping on a problem helps! My idea to get all the results was not a good one as there as many in the page. It is easier to get the few as required. This code does the job.
B4X:
Sub GetVariable
'Get the variable required
Dim Javascript As String="B4A.CallSub('GetVarFromWebview', true, document.getElementById('result_status_complete').getAttribute('style'))"
WebViewExtras1.executeJavascript(WebView1, Javascript)
End Sub
Sub GetVarFromWebview(WebVar As String)
'Called when the javascript is finished
Log("Web variable has the value => " & WebVar)
Activity.Finish
End Sub
The DIV ID tag "result_status_complete" before and after running has the value "display: none" and "". This is all that I need, combined with the tag
"result_status_error" for error checking.