def select_restore_by_date(self, path="C:/test_data", dest="C:/RESTORE"): import time time.sleep(2) testfolder = path.split("/") file_treeview = self.SysTreeView date_setting = self.SearchByDate try: # file_treeview.GetItem([file_treeview.GetItem([0]).Text()]).Click(double=True) WindowsGUIUtil.click_button(date_setting) items = [file_treeview.GetItem([0]).Text()] + [ unicode("Drive(" + testfolder[0].upper() + ")") ] # + testfolder[1:] # Select files to restore file_treeview.GetItem(items).Click(double=True, where='check') # Set destination self.set_destination(dest) time.sleep(1) self.select_overwrite() time.sleep(1) # self.select_rename() return True except Exception as exc: raise self.retry(exc=exc, countdown=60) return False
def replace_selected_computer(self, id=-1): replacebutton = self.ReplaceSelectedComputer replacecombobox = self.ReplaceComputerCombobox print replacebutton.exists() print replacecombobox.exists() WindowsGUIUtil.click_radio_button(replacebutton) # select the first computer WindowsGUIUtil.select_combobox(replacecombobox, index=id)
def apply(self): # self.OKButton.Click() # okbutton = self.OKButton # okbutton.set_focus() # okbutton.DoubleClick() okbutton = self.OKButton if WindowsGUIUtil.is_visible(okbutton): WindowsGUIUtil.click_button(okbutton)
def open_logindialog(self): # if self.continuesetupbutton.exists: continuebutton = self.ContinueSetup if continuebutton.exists(): WindowsGUIUtil.click_button(continuebutton) time.sleep(3) return True else: return False
def add_backupset(self, name="test"): """ Create a backupset :param name: backupset name :return: """ listview = self.SysListView # listview. WindowsGUIUtil.add_backupset(listview, name)
def selectinfilesystem(self, root_path="C:/test_data"): """ Select folder to be backed up :param root_path: :return: """ WindowsGUIUtil.selectinfilesystem(self.SysTreeView, root_path) import time time.sleep(2)
def select_weekly_schedule(self, time, dayofweek, every_day): time_list = time.split(":") hour = time_list[0] minute = time_list[1] if WindowsGUIUtil.is_selected(self.AutoRadioButton2): WindowsGUIUtil.select_combobox(self.ComboBox, 1) WindowsGUIUtil.set_time(self.DateTime, int(hour), int(minute)) WindowsGUIUtil.select_combobox(self.DayofWeek, dayofweek - 1) WindowsGUIUtil.input_text(self.BackupEveryDay, str(every_day))
def set_bandwidth_throttle(self, bandwidth): bandwidth_tab = { 'no backup': 0, '64kbps': 1, '128kbps': 2, '256kbps': 3, '512kbps': 4, '768kbps': 5, '1mbps': 6, '2mbps': 7, '3mbps': 8 } bandwidth_throttle = bandwidth_tab[bandwidth] WindowsGUIUtil.set_trackbar(self.Bandwidth, bandwidth_throttle)
def keyless_activate(self, username, password, encryptiontype="pkey", key="test1234"): # email = self.EmailAddressEdit # pwd = self.PasswordEdit try: # WindowsGUIUtil.input_text(email, username) # # WindowsGUIUtil.input_text(pwd, password) # # self.apply() time.sleep(20) arm_dialog = AddReplaceMachineDialog(self.oem) if WindowsGUIUtil.is_visible(arm_dialog.AddComputer): arm_dialog.add_new_computer() # arm_dialog.replace_selected_computer(-1) arm_dialog.apply() time.sleep(20) print "....Set encryption...." encryption_dialog = EncryptionDialog(self.oem) # if encryption_dialog.Button4 or encryption_dialog.UseDefaultKeyButton or encryption_dialog.UseRandomKeyButton or encryption_dialog.UsePersonalKeyButton: # encryption_dialog.set_encyption_key(encryptiontype, key) encryption_dialog.set_encyption_key(encryptiontype, key) time.sleep(2) summary_dialog = SummaryDialog(self.oem) # if summary_dialog.NextButton.exists(): if WindowsGUIUtil.is_visible(summary_dialog.NextButton): summary_dialog.apply() time.sleep(2) confirm_dialog = ConfirmationDialog(self.oem) # if confirm_dialog.SettingsDialog: if WindowsGUIUtil.is_visible(confirm_dialog.SettingsDialog): confirm_dialog.apply() time.sleep(2) except RuntimeError as e: print e return False else: return True
def set_keylessinfo(self, username, password): email = self.EmailAddressEdit pwd = self.PasswordEdit try: result = WindowsGUIUtil.input_text(email, username) if result: result = WindowsGUIUtil.input_text(pwd, password) if result: self.apply() except RuntimeError as e: print e return False else: return True
def alert_info_popup(self): time.sleep(20) alert_info = self.AlertIcon if WindowsGUIUtil.is_visible(alert_info): print "The alert info appears successfully." else: print "The alert info does not appear rightly."
def set_throttle_parameter(self, start_time, end_time): if not WindowsGUIUtil.is_selected(self.AutoRadioButton2): WindowsGUIUtil.click_button(self.ThrottleBetween) time_list1 = start_time.split(":") hour1 = time_list1[0] minute1 = time_list1[1] WindowsGUIUtil.set_time(self.StartTime, int(hour1), int(minute1)) time_list2 = end_time.split(":") hour2 = time_list2[0] minute2 = time_list2[1] WindowsGUIUtil.set_time(self.EndTime, int(hour2), int(minute2))
def set_pkey(self, pkey="test1234"): usepkeybutton = self.UsePersonalKeyButton enterkeybutton = self.EnterKeyButton if WindowsGUIUtil.is_visible(usepkeybutton): WindowsGUIUtil.click_radio_button(usepkeybutton) elif WindowsGUIUtil.is_visible(enterkeybutton): WindowsGUIUtil.click_radio_button(enterkeybutton) WindowsGUIUtil.input_text(self.EnterKeyEdit, pkey) # self.usepkeybutton.CheckByClick() # self.enterkeybutton.CheckByClick() # self.enterkeyedit.type_keys(pkey) self.apply() keyconfirmdialog = KeyConfirmDialog(self.oem) keyconfirmdialog.apply()
def choose_license_agreement(self): WindowsGUIUtil.click_button(self.Viewthelicenseagreement)
def cancel(self): WindowsGUIUtil.click_button(self.CancelButton)
def back(self): WindowsGUIUtil.click_button(self.BackButton)
def apply(self): WindowsGUIUtil.click_button(self.NextButton)
def set_location(self, path): location = self.LocationEdit WindowsGUIUtil.input_edit_content(location, path)
def finish_and_exit(self): WindowsGUIUtil.click_button(self.FinishButton)
def click_no(self): WindowsGUIUtil.click_button(self.NoButton)
def apply(self): # self.nextbutton.Click() okbutton = self.NextButton if WindowsGUIUtil.is_visible(okbutton): WindowsGUIUtil.click_button(okbutton)
def location_change_checked(self): install_location = self.CheckBox2 result = WindowsGUIUtil.is_selected(install_location) return result
def license_agreement_checked(self): licence_select = self.CheckBox1 result = WindowsGUIUtil.is_selected(licence_select) return result
def open_setupwindow(self): result = False welcome_page = self.Welcome if WindowsGUIUtil.is_visible(welcome_page): result = True return result
def exists(self): if WindowsGUIUtil.is_visible(self.OKButton): return True else: return False
def choose_location_change(self): WindowsGUIUtil.click_button(self.Chooseadifferentinstalllocation)
def cancel(self): cancelbutton = self.CancelButton if WindowsGUIUtil.is_visible(cancelbutton): WindowsGUIUtil.click_button(cancelbutton)
def apply(self): WindowsGUIUtil.click_button(self.NextButton) time.sleep(2)
def use_newencryption(self): usenewencryptionbutton = self.Button4 if usenewencryptionbutton: WindowsGUIUtil.click_radio_button(usenewencryptionbutton) self.apply()
def accept(self): WindowsGUIUtil.click_button(self.AcceptButton) time.sleep(2)