@@ -15,8 +15,8 @@ def describe_node(node):
1515 name = node .tag
1616 if node .get ('id' , '' ):
1717 name += '#' + node .get ('id' )
18- if node .get ('class' , '' ):
19- name += '.' + node .get ('class' ).replace ( ' ' , '.' )
18+ if node .get ('class' , '' ). strip () :
19+ name += '.' + '.' . join ( node .get ('class' ).split () )
2020 if name [:4 ] in ['div#' , 'div.' ]:
2121 name = name [3 :]
2222 if name in ['tr' , 'td' , 'div' , 'p' ]:
@@ -27,7 +27,7 @@ def describe_node(node):
2727 return name
2828
2929
30- def describe (node , depth = 2 ):
30+ def describe (node , depth = 1 ):
3131 global uids , uids_document
3232 doc = node .getroottree ().getroot ()
3333 if doc != uids_document :
@@ -37,8 +37,8 @@ def describe(node, depth=2):
3737 #return repr(NodeRepr(node))
3838 parent = ''
3939 if depth and node .getparent () is not None :
40- parent = describe (node .getparent (), depth = depth - 1 )
41- return parent + '/' + describe_node (node )
40+ parent = describe (node .getparent (), depth = depth - 1 ) + '>'
41+ return parent + describe_node (node )
4242
4343
4444RE_COLLAPSE_WHITESPACES = re .compile ('\s+' , re .U )
0 commit comments