Add agent_functions.py

This commit is contained in:
cesar991 2016-07-11 13:19:34 +02:00
parent cf97a5eaf7
commit 7d4e976623
1 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,42 @@
def delete_agent (driver,agent_names_list):
click_menu_element(driver,"Agents operations")
driver.find_element_by_id("option").click()
Select(driver.find_element_by_id("option")).select_by_visible_text("Bulk agent delete")
for agent_name in agent_names_list:
Select(driver.find_element_by_id("id_agents")).select_by_visible_text(agent_name)
driver.find_element_by_id("submit-go").click()
def search_agent(driver,agent_name):
click_menu_element(driver,"Agent detail")
driver.find_element_by_id("text-search").click()
driver.find_element_by_id("text-search").clear()
driver.find_element_by_id("text-search").send_keys(agent_name)
driver.find_element_by_id("submit-srcbutton").click()
driver.find_element_by_css_selector("b").click()
def create_agent(driver,agent_name,ip=None,description=None,group=None,os_id=None):
click_menu_element(driver,"Agent detail")
driver.find_element_by_id("submit-crt").click()
driver.find_element_by_id("text-agente").send_keys(agent_name)
if ip != None:
driver.find_element_by_id("text-direccion").clear()
driver.find_element_by_id("text-direccion").send_keys(ip)
if description != None:
driver.find_element_by_id("text-comentarios").clear()
driver.find_element_by_id("text-comentarios").send_keys(description)
if group != None:
Select(driver.find_element_by_id("grupo")).select_by_visible_text(group)
if os_id !=None:
Select(driver.find_element_by_id("id_os")).select_by_visible_text(os_id)
driver.find_element_by_id("submit-crtbutton").click()