本文整理汇总了Python中helperRecip.WebdriverUtilities.WebdriverUtilities.getTextFromXpathString方法的典型用法代码示例。如果您正苦于以下问题:Python WebdriverUtilities.getTextFromXpathString方法的具体用法?Python WebdriverUtilities.getTextFromXpathString怎么用?Python WebdriverUtilities.getTextFromXpathString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helperRecip.WebdriverUtilities.WebdriverUtilities
的用法示例。
在下文中一共展示了WebdriverUtilities.getTextFromXpathString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testControlEdit
# 需要导入模块: from helperRecip.WebdriverUtilities import WebdriverUtilities [as 别名]
# 或者: from helperRecip.WebdriverUtilities.WebdriverUtilities import getTextFromXpathString [as 别名]
def testControlEdit(self):
self.testname="testControlEdit"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers()
grcobject = GRCObject()
do.setUtils(util)
do.Login()
last_created_object_link = do.CreateObject("Control")
object_name = util.getTextFromXpathString(last_created_object_link)
do.NavigateToObjectAndOpenObjectEditWindow("Control",last_created_object_link)
do.PopulateObjectInEditWindow( object_name , grcobject.control_elements, grcobject.control_values)
do.ShowHiddenValues()
do.verifyObjectValues( grcobject.control_elements, grcobject.control_values)
do.deleteObject()
示例2: testProjectEdit
# 需要导入模块: from helperRecip.WebdriverUtilities import WebdriverUtilities [as 别名]
# 或者: from helperRecip.WebdriverUtilities.WebdriverUtilities import getTextFromXpathString [as 别名]
def testProjectEdit(self):
self.testname="testProjectEdit"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers()
grcobject = GRCObject()
do.setUtils(util)
do.login()
last_created_object_link = do.createObject("Project")
object_name = str(util.getTextFromXpathString(last_created_object_link)).strip()
do.navigateToObjectAndOpenObjectEditWindow("Project",last_created_object_link)
do.populateObjectInEditWindow( object_name , grcobject.project_elements, grcobject.project_values)
do.openObjectEditWindow()
do.showHiddenValues()
do.verifyObjectValues(grcobject.project_elements, grcobject.project_values)
do.deleteObject()
示例3: testProgramAuditInterviewRequest
# 需要导入模块: from helperRecip.WebdriverUtilities import WebdriverUtilities [as 别名]
# 或者: from helperRecip.WebdriverUtilities.WebdriverUtilities import getTextFromXpathString [as 别名]
def testProgramAuditInterviewRequest(self):
self.testname="TestProgramAuditInterviewRequest"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
grcobject = GRCObject()
do = Helpers()
do.setUtils(util)
do.login()
#
# Read audit_setup_data to retrieve program name and the IDs of the 3 objectives
#
objectiveID={}
f=open("audit_setup_data","r")
program_name=f.readline().strip("\n")
do.navigateToObjectWithSearch(program_name,"Program")
util.max_screen()
# 2. Choose Audit from Object page nav to bring up the Audit widget
do.navigateToAuditSectionViaInnerNavSection("Audit")
newly_created_audit = element.audit_area_created_audit.replace("AUDIT_TITLE", "2014: program - Audit")
print newly_created_audit
util.waitForElementToBePresent(newly_created_audit)
self.assertTrue(util.isElementPresent(newly_created_audit), "do not see the newly created audit " +"2014: program - Audit" )
# 6. Click on it to open the 2nd tier info. confirm there are 3 requests in the PBC Requests section.
newly_created_audit_open_link = element.audit_area_created_audit_open_link.replace("AUDIT_TITLE", "2014: program - Audit")
print newly_created_audit_open_link
util.waitForElementToBePresent(newly_created_audit_open_link)
self.assertTrue(util.isElementPresent(newly_created_audit_open_link), "do not see the newly created audit open link " )
util.clickOn(newly_created_audit_open_link)
#util.switch_to_active_element()
for objective_title in grcobject.objective_title:
objective_title_element = element.audit_pbc_request.replace("TITLE", objective_title)
print objective_title_element
util.waitForElementToBePresent(objective_title_element)
self.assertTrue(util.isElementPresent(objective_title_element), "do not see the pbc request " + objective_title_element )
#7. Change Objective 2 for Auto test of Audit - Type: Interview
# print "Change Objective 2 for Auto test of Audit - Type: Interview"
objective2_select = element.audit_pbc_request_type_select.replace("TITLE",grcobject.objective_title[1] )
objective2_selected_option = element.audit_pbc_request_type_select_selected_option.replace("TITLE",grcobject.objective_title[1] )
"""
util.waitForElementToBePresent(objective2_select)
util.selectFromDropdownUntilSelected(objective2_select, "Interview")
#verifying the selected option
util.waitForElementToBePresent(objective2_selected_option)
new_value = util.getTextFromXpathString(objective2_selected_option)
self.assertTrue(new_value =="Interview" , "the selected option is not Interview" )
"""
#click on "Objective 2 for Auto test of Audit" to open 2nd tier info
print "click on Objective 2 for Auto test of Audit to open 2nd tier info"
do.expandCollapseRequest(grcobject.objective_title[1])
#click on Edit PBC Response
util.waitForElementToBePresent(element.audit_pbc_request_expanded_content_edit_link)
self.assertTrue(util.isElementPresent(element.audit_pbc_request_expanded_content_edit_link), "do not see the Edit link in the expanded request " )
#click on Response to open that 2nd tier info
response_element = element.audit_pbc_request_response.replace("TITLE",grcobject.objective_title[1] )
print "response element " + response_element
util.waitForElementToBePresent(response_element)
self.assertTrue(util.isElementPresent(response_element), "do not see the Respond element in the expanded Request section for "+ grcobject.objective_title[1] )
print "expanding response and Edit PBC Response "
util.clickOn(response_element) #to expand the response
util.waitForElementToBePresent(element.audit_pbc_request_expanded_response_edit_link)
self.assertTrue(util.isElementPresent(element.audit_pbc_request_expanded_response_edit_link), "do not see the Edit PBS Response link in the expanded Request section for "+ grcobject.objective_title[1] )
util.clickOn(element.audit_pbc_request_expanded_response_edit_link)
#Delete
print "deleting Response"
do.deleteObject()
#collapse back the request
print "collapse back the request"
do.expandCollapseRequest(grcobject.objective_title[1])
time.sleep(3)
util.selectFromDropdownUntilSelected(objective2_select, "Interview")
time.sleep(3)
util.waitForElementToBePresent(objective2_selected_option)
new_value = util.getTextFromXpathString(objective2_selected_option)
self.assertTrue(new_value =="Interview" , "the selected option is not Interview" )
#10. Click on Objective 2 for Auto Test of Audit to open 2nd tier info (Interview)
print "click on Objective 2 for Auto test of Audit to open 2nd tier info"
do.expandCollapseRequest(grcobject.objective_title[1])
objective2_select = element.audit_pbc_request_type_select.replace("TITLE",grcobject.objective_title[1] )
util.waitForElementToBePresent(objective2_select)
util.selectFromDropdownUntilSelected(objective2_select, "Interview") # didn't work the first time
print "Hover over +PBC Request then click on Create PBC Response to launch modal"
add_pbc_response_link_within_the_objective = element.audit_pbc_request.replace("TITLE",grcobject.objective_title[1] )+element.section_add_link
create_pbc_response_link_within_the_objective = element.audit_pbc_request.replace("TITLE",grcobject.objective_title[1] )+element.section_create_link
util.waitForElementToBePresent(add_pbc_response_link_within_the_objective)
util.scrollIntoView(add_pbc_response_link_within_the_objective)
#.........这里部分代码省略.........
示例4: testProgramAudit
# 需要导入模块: from helperRecip.WebdriverUtilities import WebdriverUtilities [as 别名]
# 或者: from helperRecip.WebdriverUtilities.WebdriverUtilities import getTextFromXpathString [as 别名]
def testProgramAudit(self):
self.testname="TestProgramAudit"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
grcobject = GRCObject()
do = Helpers()
do.setUtils(util)
do.login()
#
# Read audit_setup_data to retrieve program name and the IDs of the 3 objectives
#
objectiveID={}
# default to using setup file for TEST server
setup_file = SETUP_FILE_PREFIX + TARGET_SERVER_DICT.get(config.url, "test")
f = open(os.path.join(SETUP_DIR, setup_file), "r")
program_name=f.readline().strip("\n")
##objectiveID[0]=int(f.readline().strip("\n"))
#objectiveID[1]=int(f.readline().strip("\n"))
#objectiveID[2]=int(f.readline().strip("\n"))
#print program_name
#print objectiveID
# 1. Navigate to the Program page created in Audit Part 1
#first_program_in_lhn = '//ul[@class="top-level"]//li[contains(@data-model-name,"Program")]//li[contains(.,"NAME")]/a'.replace("NAME", program_name)
#print first_program_in_lhn
do.navigateToObjectWithSearch(program_name,"Program")
util.max_screen()
# 2. Choose Audit from Object page nav to bring up the Audit widget
do.navigateToAuditSectionViaInnerNavSection("Audit")
# 3. Click on blue +Audit link in widget
util.clickOn(element.audit_area_plus_audit_link)
# 4. New Audit (modal)
new_audit_title = do.createAudit(program_name)
# 5. Confirm the audit appear in the widget
newly_created_audit = element.audit_area_created_audit.replace("AUDIT_TITLE", new_audit_title)
print newly_created_audit
util.waitForElementToBePresent(newly_created_audit)
self.assertTrue(util.isElementPresent(newly_created_audit), "do not see the newly created audit " +new_audit_title )
# 6. Click on it to open the 2nd tier info. confirm there are 3 requests in the PBC Requests section.
newly_created_audit_open_link = element.audit_area_created_audit_open_link.replace("AUDIT_TITLE", new_audit_title)
print newly_created_audit_open_link
util.waitForElementToBePresent(newly_created_audit_open_link)
self.assertTrue(util.isElementPresent(newly_created_audit_open_link), "do not see the newly created audit open link " )
util.clickOn(newly_created_audit_open_link)
util.switch_to_active_element()
util.max_screen()
#verifying the 3 objectives
for objective_title in grcobject.objective_title:
objective_title_element = element.audit_pbc_request.replace("TITLE", objective_title)
print objective_title_element
util.waitForElementToBePresent(objective_title_element)
self.assertTrue(util.isElementPresent(objective_title_element), "do not see the pbc request " + objective_title_element )
do.waitForAlertSuccessMessages()
#7. Change Objective 2 for Auto test of Audit - Type: Interview
print "Change Objective 2 for Auto test of Audit - Type: Interview"
objective2_select = element.audit_pbc_request_type_select.replace("TITLE",grcobject.objective_title[1] )
objective2_selected_option = element.audit_pbc_request_type_select_selected_option.replace("TITLE",grcobject.objective_title[1] )
util.waitForElementToBePresent(objective2_select)
util.selectFromDropdownUntilSelected(objective2_select, "Interview")
#verifying the selected option
util.waitForElementToBePresent(objective2_selected_option)
new_value = util.getTextFromXpathString(objective2_selected_option)
self.assertTrue(new_value =="Interview" , "the selected option is not Interview" )
#click on "Objective 2 for Auto test of Audit" to open 2nd tier info
print "click on Objective 2 for Auto test of Audit to open 2nd tier info"
do.expandCollapseRequest(grcobject.objective_title[1])
#click on Edit PBC Response
util.waitForElementToBePresent(element.audit_pbc_request_expanded_content_edit_link)
self.assertTrue(util.isElementPresent(element.audit_pbc_request_expanded_content_edit_link), "do not see the Edit link in the expanded request " )
#click on Response to open that 2nd tier info
response_element = element.audit_pbc_request_response.replace("TITLE",grcobject.objective_title[1] )
print "response element " + response_element
util.waitForElementToBePresent(response_element)
self.assertTrue(util.isElementPresent(response_element), "do not see the Respond element in the expanded Request section for "+ grcobject.objective_title[1] )
print "expanding response and Edit PBC Response "
util.clickOn(response_element) #to expand the response
util.waitForElementToBePresent(element.audit_pbc_request_expanded_response_edit_link)
self.assertTrue(util.isElementPresent(element.audit_pbc_request_expanded_response_edit_link), "do not see the Edit PBS Response link in the expanded Request section for "+ grcobject.objective_title[1] )
util.clickOn(element.audit_pbc_request_expanded_response_edit_link)
#Delete
print "deleting Response"
do.deleteObject()
#collapse back the request
print "collapse back the request"
do.expandCollapseRequest(grcobject.objective_title[1])
#.........这里部分代码省略.........