本文整理汇总了Python中helpers.WebdriverUtilities.WebdriverUtilities.getTextFromXpathString方法的典型用法代码示例。如果您正苦于以下问题:Python WebdriverUtilities.getTextFromXpathString方法的具体用法?Python WebdriverUtilities.getTextFromXpathString怎么用?Python WebdriverUtilities.getTextFromXpathString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.WebdriverUtilities.WebdriverUtilities
的用法示例。
在下文中一共展示了WebdriverUtilities.getTextFromXpathString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testImportExportSystem
# 需要导入模块: from helpers.WebdriverUtilities import WebdriverUtilities [as 别名]
# 或者: from helpers.WebdriverUtilities.WebdriverUtilities import getTextFromXpathString [as 别名]
def testImportExportSystem(self):
self.testname="TestImportExportSystem"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
do = Helpers(self)
do.setUtils(util)
do.login()
# create a system
systemObject =do.createObject("System")
systemObject = str(util.getTextFromXpathString(systemObject)) #it's name, not xpath
print ""
print "On screen."
print "System object is displayed as : " + systemObject
# export system
filePath = config.test_db + "SYSTEMS.csv"
do.selectMenuInTopRight("Admin Dashboard")
do.exportFile("systems", filePath)
# verify that information in file matched
self.assertTrue(do.verifyDataInExportFile(systemObject, filePath), "System object not found in exported file.")
# import system
# create some data, add it to the import file and upload
number = str(do.getRandomNumber())
systemObject = "systemImport" + number
print ""
print "Add this new system object to the import file and upload."
print "System object: " + systemObject
# proof: verify that this user never exist in the database
do.navigateToObjectWithSearchWithNoAssertion(systemObject, "System")
count = do.countOfAnyObjectLHS("System")
self.assertEqual(0, count, "System " + systemObject + " is verified not existed.")
# make it complete
conformingText = "SYSTEM-" + number + "," + systemObject + ",,,,,,[email protected],,,,,,2014-7-16,2014-7-16,,Draft"
do.appendToFile(conformingText, filePath)
do.importFile("Systems", filePath)
do.refresh()
# after import, verify that user has been added to the database
do.navigateToObjectWithSearch(systemObject, "System")
count = do.countOfAnyObjectLHS("System")
self.assertEqual(1, count, "System " + systemObject + " is not added successfully.")
self.assertEqual(systemObject, do.getObjectNavWidgetInfo("username"), "System object " + systemObject + " is not found in the database.")
print ""
print "System object is imported successfully and found in the database."
print systemObject
示例2: testAdminDBGeneral
# 需要导入模块: from helpers.WebdriverUtilities import WebdriverUtilities [as 别名]
# 或者: from helpers.WebdriverUtilities.WebdriverUtilities import getTextFromXpathString [as 别名]
def testAdminDBGeneral(self):
# [email protected] exists in the database
the_email = '[email protected]'
roles = 9 # nine types of roles
self.testname="TestAdminDBGeneral"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
do.selectMenuInTopRight("Admin Dashboard")
# verify people table
do.selectMenuItemInnerNavDashBoard("People")
self.assertTrue(do.searchPersonInAdminDB(the_email), "Cannot find it in the People table.")
people_count = do._countOfObjectsFromAdminDB("people")
self.assertEquals(1, people_count, "Expect count equals to 1, but it's " + str(people_count))
# verify Roles table
do.selectMenuItemInnerNavDashBoard("Roles")
roles_count = do._countOfObjectsFromAdminDB("roles")
self.assertEquals(roles, roles_count, "Expect count equals to" + str(roles) + ", but it's " + str(roles_count))
# verify events table
# There are more than 22 thousands entries so can't count every entries. Work-around is to verify that it
# increments by 1 when you create an object for example
do.selectMenuItemInnerNavDashBoard("Events")
events_count_before = do._countOfObjectsFromAdminDB("events")
#events_count_from_label = do._countOfObjectsFromAdminDBLabel("events")
#self.assertEquals(events_count_before, events_count_from_label, "Events count is not in sync.")
xpath = do.createObject("Contract")
title = util.getTextFromXpathString(xpath)
do.selectMenuInTopRight("Admin Dashboard")
do.selectMenuItemInnerNavDashBoard("Events")
do.delay(20) #events table takes time to load
events_count_after = do._countOfObjectsFromAdminDB("events")
#self.assertEquals(events_count_before, events_count_from_label, "Events count is not in sync.")
self.assertLess(events_count_before, events_count_after, "Count before=" + str(events_count_before) + "; Count after=" + str(events_count_after))
示例3: testRegulationEdit
# 需要导入模块: from helpers.WebdriverUtilities import WebdriverUtilities [as 别名]
# 或者: from helpers.WebdriverUtilities.WebdriverUtilities import getTextFromXpathString [as 别名]
def testRegulationEdit(self):
self.testname="TestRegulationEdit"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
grcobject = GRCObject()
do.setUtils(util)
do.login()
last_created_object_link = do.createObject("Regulation")
object_name = str(util.getTextFromXpathString(last_created_object_link)).strip()
do.navigateToObjectAndOpenObjectEditWindow("Regulation",last_created_object_link)
do.populateObjectInEditWindow( object_name , grcobject.regulation_elements, grcobject.regulation_values)
do.openObjectEditWindow()
do.verifyObjectValues(grcobject.regulation_elements, grcobject.regulation_values)
do.deleteObject()