??????? xml ?????????δ?????????????????????????? python ?? xml ?????????????????????д????????????????????? xml ??????????

from xml.dom import minidom
class PageData():
def __init__(self?? page_name?? file):
self.name = page_name
self.data = minidom.parse(file)
self.xpth_dict = self.XML_Dict()
def XML_Dict(self):
xpath_dict = {}
for i in self.data.getElementsByTagName(self.name):
xpath_dict[str(i.childNodes[1].firstChild.nodeValue)] =
[str(i.childNodes[5].firstChild.nodeValue)??
str(i.childNodes[7].firstChild.nodeValue)]
return xpath_dict
def GetLocator(self?? object_name):
return self.xpth_dict[object_name][0]
def GetValue(self?? object_name):
return self.xpth_dict[object_name][1]


???????????????棬????????????????????????????????????????

def testAutoCompleteFunctionMouseMove(self):
'''test the function of auto complete. case 2: when user move mouse to the suggestion?? there will be a link '''
self.initTest("testAutoCompleteFunctionMouseMove")
self.open('http://www.google.com/ncr')
GoogleHomePage = data_parser.PageData("GoogleHomePage"?? self.data_file)
self.Type(GoogleHomePage.GetLocator('SEARCHTEXT')?? 's')
GoogleAutoComplete = data_parser.PageData("AutoCompleteCase"?? self.data_file)
self.isElementPresent(GoogleAutoComplete.GetLocator("SUGGESTIONFIELD"))
time.sleep(10)
self.MouseMove(GoogleAutoComplete.GetLocator("SUGGESTIONONEFORS"))
expect_text = "I'm Feeling Lucky ?"
self.assertLogTrue(self.isTextPresent(expect_text)?? "The text %s has been displayed" %expect_text)
self.MouseMove(GoogleAutoComplete.GetLocator("SUGGESTIONTWOFORS"))
time.sleep(10)
self.assertLogTrue(self.isTextPresent(expect_text)?? "The text %s has been displayed" %expect_text)
self.endTest()


?????????????????????????????????????????????????????????????????????????????Щ?1????????????????????????????????????????????????????

???????

???????????????????????????κε???????飬???????????????е?С??????????????????????????????? ?????????и???? test frame ????????