With a webviewer I have named wvSOS, I am using the following:
MBS("WebView.Evaluate"; "wvSOS";
"document.querySelector('table')"
)
AND
MBS("WebView.Evaluate"; "wvSOS";
"new DOMParser().parseFromString( document.documentElement.outerHTML, 'text/html').querySelector('table')"
)
…. i get a [MBS] Windows error: -2147352319
Environment is FM Pro 17 and MBS 15.2.0.09
Ideas?
How about using MBS("Trace") to log this?
Also with FM 17 you use IE, so you can only use functions, that exists in the old IE engine.
This is the trace…..
Result #7: "OK"
MBS Plugin call #8 with 2 parameters.
Parameter 0 FunctionName: "WebView.GetHTMLText"
Parameter 1 WebViewerRef: "wvSOS"
Result #8: "DIRECT ACCESS SUBSCRIBER LOGIN
<LINK rel=stylesheet t..." (13831 characters)
MBS Plugin call #9 with 3 parameters.
Parameter 0 FunctionName: "WebView.Evaluate"
Parameter 1 WebViewerRef: "wvSOS"
Parameter 2 Expression: "new DOMParser().parseFromString( document.documentElement.outerHTML, 'text/html').querySelector('table')"
Result #9: "[MBS] Windows error: -2147352319"
MBS Plugin call #10 with 3 parameters.
Parameter 0 FunctionName: "WebView.Evaluate"
Parameter 1 WebViewerRef: "wvSOS"
Parameter 2 Expression: "document.querySelector('table')"
Result #10: "[MBS] Windows error: -2147352319"
MBS Plugin call #11 with 1 parameter.
Parameter 0 FunctionName: "Version"
Result #11: "15.2.0.09"
Which MBS functions let me use js against the contents of webviewer in the old IE?
Well, you could start with little things and go step by step.
e.g. do MBS("WebView.Evaluate"; "wvSOS"; "1+2") to see if it works and returns 3.
document.querySelector returnes a NodeList, so check some details.
MBS("WebView.Evaluate"; "wvSOS"; "document.querySelector('table').length")
maybe that works? You can't return the node list directly.
"var table = document.querySelector ? document.querySelector('table') : (document.getElementsByTagName('table')[0] || null);table" sets $r to [OBJECT].
document.querySelector ? document.querySelector('table') : (document.getElementsByTagName('table')[0] || null) does the same thing.
how do I look at [OBJECT]?
…the 1+2 works just fine.
You can't look on [OBJECT]. You need to have it return values.
Maybe encode stuff as JSON if that works in IE.