dogtail How can I find a table cell by using regular expression?



Hi all

I'm a new in dogtail. My current work is developing a program to test 
virt-manager.

I chose dogtail to help me. But now , I have some question.
In virt-manager, a guest's network card will be presented in a table 
cell named "NIC :XX:XX:XX". The "XX:XX:XX" is this network card's MAC 
address. As we all know that's unexpected.
So I read the dogtail's src. Add this code in predicate.py:
class IsAnTableCellNamed(Predicate):
     """Search subclass that looks for an tablecell by name"""
     def __init__(self, cellName):
         self.cellName = TranslatableString(cellName)
         self.debugName = self.describeSearchResult()
         self.satisfiedByNode = self._genCompareFunc()

     def _genCompareFunc(self):
         def satisfiedByNode(node):
             return node.roleName=='table cell' and 
stringMatches(self.cellName, node.name)
         return satisfiedByNode

     def describeSearchResult(self):
         return '%s table cell'%self.cellName

     def makeScriptMethodCall(self, isRecursive):
         # ignores the isRecursive parameter
         return "table cell(%s)"%self.cellName

     def makeScriptVariableName(self):
         return makeCamel(self.cellName)+"Table cell"

Hope that can help me use a regular expression to get a list of network 
cards.
But it doesn't work.

Someone can help me ?
THX

Best regards
Weiqing Wang


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]