Add edit_dashboard function

This commit is contained in:
cesar991 2016-07-06 12:56:11 +02:00
parent 0346516129
commit ab212422c1
1 changed files with 25 additions and 2 deletions

View File

@ -4,7 +4,7 @@ from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait, Select
from selenium.webdriver.support import expected_conditions as EC
import random
import random, time
import string
def gen_random_string(size,preffix=None):
@ -230,6 +230,29 @@ def delete_dashboard(driver,name):
driver.find_element_by_xpath('//*[@id="table2-0-1"]/a[1]/img').click()
def edit_dashboard(driver,name,new_number_cell=None,new_group=None,new_name=None):
click_menu_element(driver,"Main dashboard")
driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[4]/a/img').click()
Select(driver.find_element_by_id("id_dashboard")).select_by_visible_text(name)
if new_number_cell != None:
driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[4]/a/img').click()
driver.find_element_by_id("text-number_cells").clear()
driver.find_element_by_id("text-number_cells").send_keys(new_number_cell)
driver.find_element_by_id('button-update_cells').click()
time.sleep(3)
if new_group != None:
driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[4]/a/img').click()
Select(driver.find_element_by_id("group_dashboard")).select_by_visible_text(new_group)
driver.find_element_by_id('button-update_group_dashboard').click()
time.sleep(3)
if new_name != None:
driver.find_element_by_xpath('//*[@id="menu_tab"]/ul/li[4]/a/img').click()
driver.find_element_by_id("text-name_dashboard").clear()
driver.find_element_by_id("text-name_dashboard").send_keys(new_name)
driver.find_element_by_id('button-update_name_dashboard').click()