Add apply_policy_to_agent function

This commit is contained in:
cesar991 2016-07-28 12:23:22 +02:00
parent 2b59dc1726
commit b95d63571a
1 changed files with 21 additions and 0 deletions

View File

@ -51,3 +51,24 @@ def add_collection_to_policy(driver,policy_name,collection_name):
driver.find_element_by_xpath('//*[@id="main"]/table[2]/tbody/tr/td[3]/input').click() driver.find_element_by_xpath('//*[@id="main"]/table[2]/tbody/tr/td[3]/input').click()
driver.find_element_by_xpath('//*[@id="table3-0-4"]/a/img').click() driver.find_element_by_xpath('//*[@id="table3-0-4"]/a/img').click()
def apply_policy_to_agent(driver,policy_name,list_agent):
#Example by list_agent: list_agent=("PAN_14_1","PAN_14_2")
search_policy(driver,policy_name,go_to_policy=True)
driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[10]/a/img').click()
for agent in list_agent:
Select(driver.find_element_by_id("id_agents")).select_by_visible_text(agent)
driver.find_element_by_xpath('//*[@id="image-add1"]').click()
alert = driver.switch_to_alert()
alert.accept()
driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[9]/a/img').click()
driver.find_element_by_xpath('//*[@id="main"]/div[4]/form[2]').click()
alert = driver.switch_to_alert()
alert.accept()