4

I want to run automated UI tests in my ExtJS4 application. I don't want to use Siesta, the Testing Tool from Sencha. Instead, I want to use a custom tool.

The application uses a TreePanel. To support the automated UI test, it is mandatory that each treenode (Ext.data.NodeInterface) has a unique and language independent identifier as attribute in its HTML representation.

This identifier should be set at the treenode when added to the tree. A custom ExtJS plugin for the treepanel should then render the identifier from the treenode object to its HTML representation.

So, my problem is: How do I get the DOM element of an Ext.data.NodeInterface?

Thanks in advance.

n.dee
  • 333
  • 1
  • 3
  • 12
  • I had some pending questions. A accepted them now. :) – n.dee Nov 29 '12 at 08:06
  • Do I understand correctly that you want to explicitly define the DOM id of each tree node? That is, the programmer (you, I guess) will have a config per node that will end up as the DOM element id? – Izhaki Nov 29 '12 at 10:09
  • No, I want to extend the DOM element of node with a custom attribute. – n.dee Nov 30 '12 at 14:45

1 Answers1

6

If you know the record ID of the node you are trying to target then you can try the following:

var myNode = tree.getStore().getNodeById(id);
var nodeElement = tree.getView().getNode(myNode);
dbrin
  • 15,525
  • 4
  • 56
  • 83