def main(): if node in ["rwsoda6s005", "scaoda7m005", "scaoda710c1n", "rwsoda6f004", "rwsoda6m005", "scaoda7s005", "scaoda704c1n", "10.31.129.245"]: ll.login(node) ui.WebDriverWait(driver, 30).until( ec.element_to_be_clickable((By.CSS_SELECTOR, "ul>li:nth-child(5)>a[role='button']>span"))) driver.find_element_by_css_selector("ul>li:nth-child(5)>a[role='button']>span").click() time.sleep(2) driver.find_element_by_css_selector("ul>li:nth-child(3)>a[role='button']>span").click() time.sleep(10) driver.find_element_by_xpath('// *[ @ id = "dbhome"]/a/span').click() time.sleep(5) driver.find_element_by_xpath('//*[@id="database"]/a/span').click() a = driver.find_elements_by_xpath('//*[@id="initialDb"]/div/button/div/span') if len(a) == 0: driver.find_element_by_xpath('//*[@id="createDatabase"]/div/span').click() else: a[0].click() time.sleep(1) driver.find_element_by_xpath('//*[@id="nextCreateDbButtonId"]/div/span').click() time.sleep(1) ed.input_db("password", "cpassword") driver.find_element_by_xpath('//*[@id="okCreateDb"]/div/span').click() time.sleep(1) cm.by_id_click('yesButton') ui.WebDriverWait(driver, 30).until(ec.element_to_be_clickable((By.ID, "createDbSubmitDialog"))) time.sleep(1) driver.find_element_by_xpath('//*[@id="createDbSubmitDialog"]/div[2]/div/div/div[3]/a')
def input_cdb_info(driver=driver1): cdb = random.choice(["yesCdb", "noCdb"]) # cdb = random.choice(["yesCdb"]) cm.by_id_click(cdb, driver) if cdb == "yesCdb": for key, value in pdbName_text_box.items(): cm.by_id_input(key, value, driver)
def input_custom_user(): cm.by_id_click("%s" % OsRole) if OsRole == "yesOsRole": for key, value in yesOsRole_text_box.items(): cm.by_id_input(key, value) elif OsRole == "noOsRole": for key, value in noOsRole_text_box.items(): cm.by_id_input(key, value)
def config_asr(): for key, value in asr_dropdown_lists.items(): cm.by_id_select(key, value) if ojChoiceId_asrType_selected == "INTERNAL": cm.by_id_click("%s" % Proxy) for key, value in asr_text_box.items(): cm.by_id_input(key, value) elif ojChoiceId_asrType_selected == "EXTERNAL": cm.by_id_input("asrManagerIp", "%s" % asrManagerIp)
def create_database_frombackup_restore_page(driver): jsonfile_path = "D:\sendjsonfile.exe D:\my.json" numofchannel = random.randint(1, 5) using_existing_dbhome = random.choice([True, False]) emconsole = random.choice( ["noBackupReportEnableConsole", "yesBackupReportEnableConsole"]) cm.option_random_choice( "ojChoiceId_objectStoreSelectionName_selected", '//*[@id="oj-listbox-results' '-objectStoreSelectionName"]/li/div', driver) driver.find_element_by_id("backupReportFileId").click() time.sleep(3) os.system(jsonfile_path) cm.by_id_input("backupReportRmanPasswords", backuprmanpassword, driver) cm.by_id_input("backupReportRmanPasswordsRepeat", backuprmanpassword, driver) cm.by_id_input("bkupReportDbName", dbName, driver) cm.by_id_input("bkupReportDbUniqueName", dbUniqueName, driver) if using_existing_dbhome: driver.find_element_by_id("existingBackupReportDbHome").click() if cm.is_element_exist_by_id("oj-listbox-results-backupReportDbHome", driver): cm.option_random_choice( "oj-select-choice-backupReportDbHome", '//*[@id="oj-listbox-results-backupReportDbHome"]/li/div', driver) else: create_dbfrombackup_choose_dbversion(driver) else: create_dbfrombackup_choose_dbversion(driver) if cm.is_element_exist_by_id("ojChoiceId_bkupReportDbType_selected", driver): cm.option_random_choice( "ojChoiceId_bkupReportDbType_selected", '//*[@id="oj-listbox-results-bkupReportDbType"]/li/div', driver) cm.option_random_choice( "ojChoiceId_bkupReportDbShape_selected", '//*[@id="oj-listbox-results-bkupReportDbShape"]/li/div', driver) cm.option_random_choice( "oj-select-choice-bkupReportDbClass", '//*[@id="oj-listbox-results-bkupReportDbClass"]/li/div[not(@aria-disabled)]', driver) cm.option_random_choice( "ojChoiceId_bkupReportDbStorage_selected", '//*[@id="oj-listbox-results-bkupReportDbStorage"]/li/div[not(@aria-disabled)]', driver) # cm.by_id_input("noOfRmanChannels", numofchannel, driver) time.sleep(2) if emconsole == "yesBackupReportEnableConsole": cm.by_id_click(emconsole, driver) cm.by_id_input("bkupReportSysPassword", '%s' % dbsyspassword, driver) cm.by_id_input("bkupReportCSysPassword", '%s' % dbsyspassword, driver) driver.find_element_by_xpath('//*[@id="okRestoreDb"]/div/span[1]').click() time.sleep(1) cm.by_id_click("yesCreateDbUsingExistingBackup", driver)
def create_database(driver): go_database_tab_database_create_database_tab(driver) time.sleep(1) driver.find_element_by_xpath( '//*[@id="nextCreateDbButtonId"]/div/span').click() time.sleep(1) dbhome = random.choice([True, False]) ed.input_db("password", "cpassword", dbhome, db1, driver) driver.find_element_by_xpath('//*[@id="okCreateDb"]/div/span').click() time.sleep(1) cm.by_id_click('yesButton', driver) status = submit_job_status(driver, "createDbSubmitDialog") return status
def main(): if node in [ "rwsoda6s005", "scaoda7m005", "scaoda710c1n", "rwsoda6f004", "rwsoda6m005", "scaoda7s005", "scaoda704c1n", "10.31.129.245", "10.31.130.36" ]: ll.login(node) ui.WebDriverWait(driver, 30).until( ec.visibility_of_element_located((By.ID, "getStartContainer"))) driver.find_element_by_xpath( '//*[@id="getStartContainer"]/button/div/span').click() es.input_system_network(node) if UserGroup == "yesUserGroup": cm.by_id_click("%s" % UserGroup) eu.input_custom_user() if InitialDb == "yesInitialDb": ed.input_db() elif InitialDb == "noInitialDb": cm.by_id_click("%s" % InitialDb) if Asr == "yesAsr": cm.by_id_click("%s" % Asr) ea.config_asr() ui.WebDriverWait(driver, 30).until( ec.element_to_be_clickable((By.ID, "submit"))) driver.find_element_by_id('submit').click() ui.WebDriverWait(driver, 30).until( ec.element_to_be_clickable((By.ID, "confirmDialogYesButton"))) time.sleep(1) driver.find_element_by_id('confirmDialogYesButton').click() ui.WebDriverWait(driver, 30).until( ec.element_to_be_clickable((By.ID, "JobSubmitDialog"))) time.sleep(1) driver.find_element_by_xpath( '//*[@id="JobSubmitDialog"]/div/div/div/div[3]/a').click() time.sleep(120) else: print "This node is NOT supported" ll.logout()
def input_db(x="adminPwd", y="cpadminPwd", dbhome=False, db1=dbName, driver=driver1): cm.by_id_input("dbName", db1, driver) cm.by_id_input("dbUniqueName", dbUniqueName, driver) # for key, value in dbName_text_box.items(): # cm.by_id_input(key, value) # for key, value in db_choice.items(): # cm.option_random_choice(key, value) if dbhome: cm.by_id_click("existingDbHome", driver) cm.option_random_choice("oj-select-choice-dbHome", '//*[@id="oj-listbox-results-dbHome"]/li/div', driver) else: cm.option_random_choice( "ojChoiceId_dbVersion_selected", '//*[@id="oj-listbox-results-dbVersion"]/li/div[not (@aria-disabled)]', driver) cm.option_random_choice( "ojChoiceId_dbEdition_selected", '//*[@id="oj-listbox-results-dbEdition"]/li/div', driver) cm.option_random_choice("oj-select-choice-dbShape", '//*[@id="oj-listbox-results-dbShape"]/li/div', driver) cm.option_random_choice( "ojChoiceId_dbClass_selected", '//*[@id="oj-listbox-results-dbClass"]/li/div[not (@aria-disabled)]', driver) cm.option_random_choice( "ojChoiceId_dbStorage_selected", '//*[@id="oj-listbox-results-dbStorage"]/li/div[not (@aria-disabled)]', driver) cm.option_random_choice("ojChoiceId_dbCharset_selected", '//*[@id="oj-listbox-results-dbCharset"]/li/div', driver) cm.option_random_choice( "ojChoiceId_dbNlsCharset_selected", '//*[@id="oj-listbox-results-dbNlsCharset"]/li/div', driver) cm.option_random_choice("ojChoiceId_dbLanguage_selected", '//*[@id="oj-listbox-results-dbLanguage"]/li/div', driver) cm.option_random_choice( "ojChoiceId_dbTerritory_selected", '//*[@id="oj-listbox-results-dbTerritory"]/li/div', driver) if cm.is_element_exist_by_id("yesCdb", driver): input_cdb_info(driver) if cm.is_element_exist_by_id("ojChoiceId_dbType_selected", driver): cm.option_random_choice("ojChoiceId_dbType_selected", '//*[@id="oj-listbox-results-dbType"]/li/div', driver) if cm.is_element_exist_by_id("nodeNumber0", driver): choose_option(node_list, driver) if cm.is_element_exist_by_id("yesFlash", driver): choose_option(flash_list, driver) cm.by_id_click(EmConsole, driver) cm.by_id_input(x, password2, driver) cm.by_id_input(y, password2, driver)
def choose_option(x, driver=driver1): a = random.choice(x) cm.by_id_click(a, driver)