TrUMP uses xpath to validate the return nodes. For that, we use the following method,
var xpathResult = document.evaluate( xpathExpression, contextNode, namespaceResolver, resultType, result ); Here is more details about it, https://developer.mozilla.org/en/Introduction_to_using_XPath_in_JavaScript One interesting problem we encountered is the "document" variable. For multiple windows such as Firefox plugins, the document is actually pointing to the plugin window, not the main window. So comes the question: "How to get access to the main window from the plugin window?" I tried "window.opener.document" as someone suggested, but with no luck. Finally, I found a solution to this. In TrUMP, we have reference to the main window Dom Node, which has an attribute: ownerDocument. Yes, you can use that to get the document for the main window. Some sample code here, var xpct = "count(//descendant-or-self::table/descendant-or-self::input [...@type='submit' and @value='Google Search' and @name='btnG'])"; var curdoc = this.domNode.ownerDocument; var result = curdoc.evaluate(xpct, curdoc, null, XPathResult.NUMBER_TYPE, null); alert("Get XPath evalution result " + result.numberValue); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "tellurium-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/tellurium-users?hl=en -~----------~----~----~----~------~----~------~--~---
