If the browser cannot evaluate a method or property after ExecMethod sends it, Silk Test Classic is unable to provide any further information, such as runtime errors, because it cannot retrieve them from the browser. Furthermore, Silk Test Classic cannot know how much or how little of the language set (JavaScript) that the browser supports.
Calling ExecMethod() on a BrowserChild executes the JavaScript against the ‘Window’ object for that frame. You can use it to access ‘document’ properties/methods of a frame. To do so, you must include ‘document’ in the ExecMethod() call:
TheFrame.ExecMethod ("document.<property>")
To find the HTML class name of an object:
STRING sHTMLClass = TheHtmlObject.ExecMethod("tagName")
To find the full HTML for an object:
STRING sFullHTML = TheHtmlObject.ExecMethod("outerHTML")
// This example prints the HTML class name of the first JavaScript child element of the object INTEGER iSourceIndex = Val (TheHtmlObject.ExecMethod("sourceIndex")) Print (BrowserPage.ExecLine ("document.all[{iSourceIndex}].children[0].tagName"))
STRING sPath = TheHtmlLink.ExecMethod('getAttribute("pathname")')
STRING sDisabled = TheHtmlLink.ExecMethod('getAttribute("disabled")')
STRING sOnClick = TheHtmlObject.ExecMethod('getAttribute("onclick")')
STRING sBgColor = TheFrame.ExecMethod ("document.bgColor")
or
STRING sBgColor = TheFrame.ExecMethod ("document.body.currentStyle.backgroundColor")