def save_patching_window(self): self.save_dialog() self._wait_for_processing() if self.patchingIframe.is_element_existed(): driver.select_frame(self.patchingIframe) self._wait_for_processing() driver.unselect_frame()
def select_event_log_filter_tab(self, eventTab): self.dynamicEventsTab.arguments = [eventTab] self._select_iframe(self.uniqueIframe, self.dynamicEventsTab) self.dynamicEventsTab.click_visible_element() self.dynamicEventsExpandTab.arguments = [eventTab] self.dynamicEventsExpandTab.wait_until_element_is_visible() driver.unselect_frame()
def check_task_list_information_on_patching_window(self, position, name, taskType, treeFrom, connectionType, treeTo): self.dynamicTaskListTable.arguments = [position] self.dynamicTaskName.arguments = [ self.dynamicTaskListTable.locator(), name ] self.dynamicTaskType.arguments = [ self.dynamicTaskListTable.locator(), taskType ] self.dynamicTaskTreeFrom.arguments = [ self.dynamicTaskListTable.locator(), treeFrom ] self.dynamicTaskConnectType.arguments = [ self.dynamicTaskListTable.locator(), connectionType ] self.dynamicTaskTreeTo.arguments = [ self.dynamicTaskListTable.locator(), treeTo ] driver.select_frame(self.patchingIframe) self.dynamicTaskTreeTo.mouse_over() SeleniumAssert.element_should_be_visible(self.dynamicTaskName) SeleniumAssert.element_should_be_visible(self.dynamicTaskType) SeleniumAssert.element_should_be_visible(self.dynamicTaskTreeFrom) SeleniumAssert.element_should_be_visible(self.dynamicTaskConnectType) SeleniumAssert.element_should_be_visible(self.dynamicTaskTreeTo) driver.unselect_frame()
def create_quareo_unmanaged_connections(self, filterType, typeConnect="Connect", cableFrom=None, cableTo=None, portsTo=None, delimiter=","): """typeConnect': Connect or Disconnect ... 'filterType': Unassigned Quareo ports OR Assigned Quareo ports ... 'cableFrom': the source tree node (containing the end point). Ex: Site/Building/Floor 01/Room 01/1:1 Rack 001/Switch 01/01 ... 'cableTo': the destination tree node (not containing the end point). Ex: Site/Building/Floor 01/Room 01/1:1 Rack 001/Switch 01 ... 'portsTo': containing 1 or many end points. Ex: 02,03,04. Quantity of ports_to must be equal quantity of mpo_branches ... 'delimiter': the delimiter for mpo_branches and ports_to, the default value is ,""" self._filter_on_quareo_unmanaged(filterType) listPortTo = portsTo.split(delimiter) driver.select_frame(self.qUCIframe) self._wait_for_processing() self._click_tree_node(self.treeFromDiv, cableFrom) temp = 0 for portTo in listPortTo: pathTo = cableTo + "/" + portTo self._click_tree_node(self.treeToDiv, pathTo) connection._set_connection(typeConnect) self._wait_for_processing() temp += 1 driver.unselect_frame()
def view_memorized_report(self, reportName): self._select_iframe(self.uniqueIframe, report.viewReportTbl) returnRow = report.viewReportTbl._get_table_row_map_with_header( "Name", reportName) report.viewReportTbl._click_table_cell(returnRow, 1) report.viewBtn.click_visible_element() driver.unselect_frame()
def fill_data_in_add_event_log_filter(self, eventName=None, eventTab=None, events=None, save=False, delimiter=","): self._select_iframe(self.uniqueIframe, self.nameTxt) self.nameTxt.input_text(eventName) if eventTab is not None: self.dynamicEventsTab.arguments = [eventTab] self.dynamicEventsTab.click_visible_element() self.dynamicEventsExpandTab.arguments = [eventTab] self.dynamicEventsExpandTab.wait_until_element_is_visible() if events is not None: listEvents = events.split(delimiter) for event in listEvents: self.dynamicEventsChk.arguments = [event] self.dynamicEventsChk.select_checkbox(True) if save: self.confirmDialogBtn.click_visible_element() driver.unselect_frame() self.confirmDialogBtn.wait_until_element_is_visible() self.confirmDialogBtn.click_visible_element() else: driver.unselect_frame()
def add_list_on_administration(self, listType, name, imagePath=None, iconType=None): self.dynamicGroupListTitle.arguments = [listType] self._select_iframe(self.uniqueIframe, self.dynamicGroupListTitle) self.dynamicGroupListTitle.click_visible_element() self.addBtn.wait_until_page_contains_element() self.addBtn.click_visible_element() self.listNameTxt.wait_until_element_is_visible() self.listNameTxt.input_text(name) if imagePath is not None: temp = 0 while (not administration.uploadFileTxt.is_element_present() and temp < constants.SELENPY_DEFAULT_TIMEOUT): self.equipmentImageBtn.mouse_over() self.equipmentImageBtn.wait_until_element_attribute_contains( "class", "hover") temp += 1 administration.uploadFileTxt.choose_file(imagePath) self.equipmentViewImg.wait_until_element_is_visible() if iconType is not None: self.listIconTypeCbb.select_from_list_by_label(iconType) self.confirmAddListBtn.click_visible_element() driver.unselect_frame()
def create_cabling(self, typeConnect="Connect", cableFrom=None, cableTo=None, mpoTab=None, mpoType=None, mpoBranches=None, portsTo=None, delimiter=","): """typeConnect': Connect or Disconnect ... 'cableFrom': the source tree node (containing the end point). Ex: Site/Building/Floor 01/Room 01/1:1 Rack 001/Switch 01/01 ... 'cableTo': the destination tree node (not containing the end point). Ex: Site/Building/Floor 01/Room 01/1:1 Rack 001/Switch 01 ... 'mpoTab': when cabling for mpo port type(2 options: Mpo12, Mpo24) ... 'mpoType': Options: Mpo12_Mpo12, Mpo12_4xLC, Mpo12_6xLC, Mpo24_Mpo24, Mpo24_12xLC, Mpo24_3xMpo12, Mpo24_2xMpo12, Mpo12_6xLC_EB ... 'mpoBranches': when cabling for mpo port type(is depended on mpo_type). Ex: B1,B2,B3 ... 'portsTo': containing 1 or many end points. Ex: 02,03,04. Quantity of ports_to must be equal quantity of mpo_branches ... 'delimiter': the delimiter for mpo_branches and ports_to, the default value is ,""" listPortTo = portsTo.split(delimiter) if mpoBranches is not None: listMpoBranch = mpoBranches.split(delimiter) driver.select_frame(connection.cablingFrame) self._wait_for_processing() connection.cabTreeFromDiv.click_tree_node(cableFrom) connection._select_mpo_connection_tab(mpoTab) connection._select_mpo_connection_type(mpoType) temp = 0 for portTo in listPortTo: if mpoBranches is not None: connection._select_mpo_branch(listMpoBranch[temp]) pathTo = cableTo + "/" + portTo connection.cabTreeToDiv.click_tree_node(pathTo) connection._set_connection(typeConnect) self._wait_for_processing(3) temp += 1 driver.unselect_frame()
def fill_custom_geomap_map_view(self, urlTemplate=None, maxZoomLevel=None, attributeText1=None, attributeUrl1=None, attributeText2=None, attributeUrl2=None, attributeText3=None, attributeUrl3=None, save=False, confirm=False): self.dynamicUseCustomGeomapServerChk.arguments = ["Map"] self._select_iframe(self.uniqueIframe, self.dynamicUseCustomGeomapServerChk) self.dynamicUseCustomGeomapServerChk.select_checkbox() self.serverMapViewUrlTemplateTxt.input_text(urlTemplate) self.serverMapViewMaxZoomLevelTxt.input_text(maxZoomLevel) self.serverMapViewAttributionLinkText1Txt.input_text(attributeText1) self.serverMapViewAttributionLinkUrllink1Txt.input_text(attributeUrl1) self.serverMapViewAttributionLinkText2Txt.input_text(attributeText2) self.serverMapViewAttributionLinkUrllink2Txt.input_text(attributeUrl2) self.serverMapViewAttributionLinkText3Txt.input_text(attributeText3) self.serverMapViewAttributionLinkUrllink3Txt.input_text(attributeUrl3) if save: self.saveGeomapOptionsBtn.click_visible_element() driver.unselect_frame() if confirm: self.confirmDialogBtn.click_visible_element() else: driver.unselect_frame()
def set_feature_options(self, allowCrossZonePatching): self._select_iframe(self.uniqueIframe, self.allowCrossZonePatchingChk) self.allowCrossZonePatchingChk.select_checkbox(allowCrossZonePatching) administration.saveBtn.click_visible_element() driver.unselect_frame() self.confirmDialogBtn.click_visible_element() self.confirmDialogBtn.wait_until_element_is_not_visible()
def _check_mpo_connection_type_information(self, frame, mpoConnectionTab=None, mpoConnectionType=None, mpoBranches=None, title=None): self.dynamicConnectionType.arguments = [ mpoConnectionType, mpoConnectionType ] self.dynamicSelectedConnectionType.arguments = [mpoConnectionType] self.dynamicViewTab.arguments = [mpoConnectionTab + " Connection Type"] self._select_iframe(frame, self.dynamicViewTab) self._wait_for_processing() self._select_mpo_connection_tab(mpoConnectionTab) self._select_mpo_connection_type(mpoConnectionType) if (mpoConnectionTab is not None) and (mpoConnectionType is not None): SeleniumAssert.element_should_be_visible( self.dynamicConnectionType) SeleniumAssert.element_should_be_visible( self.dynamicSelectedConnectionType) if mpoBranches is not None: listMpoBranch = mpoBranches.split(",") for branch in listMpoBranch: self.dynamicMpoBranch.arguments = [branch] SeleniumAssert.element_should_be_visible(self.dynamicMpoBranch) if title is not None: self._check_title_attribute(self.dynamicConnectionType, title) driver.unselect_frame()
def wait_until_discover_device_successfully(self, switchName=None, ipAdd=None, timeOut=constants.SELENPY_SYNCSWITCH_TIMEOUT, closeWindow=True): """Wait until the discover device switch successful in SNMP Status Window. ... We have 4 arguments: ... - 'switchName': name of switch ... - 'ipAdd': IP address of switch ... - 'timeOut' ... - 'closeWindow'""" self.snmpStatusIframe.wait_until_page_contains_element() driver.select_frame(self.snmpStatusIframe) self.snmpTaskStatusIframe.wait_until_page_contains_element() driver.select_frame(self.snmpTaskStatusIframe) self._wait_for_processing() self.snmpStatusTbl.wait_until_element_is_visible() waitSwitchDiscover = "Discover Devices"+ "--" + switchName + "--" + ipAdd for i in range(0, int(timeOut)): self.refreshBtn.click_element() time.sleep(1) # hard sleep to waiting for the status changing to successful returnRow = self.snmpStatusTbl._get_table_row_map_with_header("Action Type--Device--IP Address", waitSwitchDiscover, "--") if(returnRow > 0): i += 1 else: break driver.unselect_frame() if closeWindow: self.close_snmp_status_window()
def wait_until_synchronize_successfully(self, switchName=None, ipAdd=None, timeOut=constants.SELENPY_SYNCSWITCH_TIMEOUT, closeWindow=True): """Use to wait until the status of switch change to "Scheduled" in SNMP Status Window ... We have 4 arguments: ... - 'switchName': name of switch ... - 'ipAdd': IP address of switch ... - 'timeOut' ... - 'closeWindow'""" self.snmpStatusIframe.wait_until_page_contains_element() driver.select_frame(self.snmpStatusIframe) self.snmpTaskStatusIframe.wait_until_page_contains_element() driver.select_frame(self.snmpTaskStatusIframe) self.snmpStatusTbl.wait_until_element_is_visible() pssInfo = "Poll Switch Status"+ "--" + switchName + "--" + ipAdd + "--" + "Scheduled" ddErrorInfo = "Discover Devices Information"+ "--" + switchName + "--" + ipAdd + "--" + "Scheduled For Automatic Retry" for i in range(0, timeOut): self.refreshBtn.click_element() time.sleep(1) # hard sleep to waiting for the status changing to successful pssRow = self.snmpStatusTbl._get_table_row_map_with_header("Action Type--Device--IP Address--Status", pssInfo, "--") ddErrorRow = self.snmpStatusTbl._get_table_row_map_with_header("Action Type--Device--IP Address--Status", ddErrorInfo, "--") if pssRow > 0: syncTime = utils.get_current_date_time(resultFormat="%#m/%#d/%#Y %I:%M") break elif ddErrorRow > 0: utils.fatal_error("This managed switch cannot be synchronized. Please double-check it") else: i += 1 driver.unselect_frame() if closeWindow: self.close_snmp_status_window() return syncTime
def view_report(self, reportName): self._select_iframe(self.uniqueIframe, self.reportTbl) returnRow = self.reportTbl._get_table_row_map_with_header("Name", reportName) self.reportTbl._click_table_cell(returnRow, 1) report.viewBtn.click_visible_element() self._wait_for_processing() driver.unselect_frame()
def click_edit_button_on_wo_queue_window(self, woName): self._select_iframe(workOrders.woQueueIframe, self.markCompleteBtn) returnRow = self.get_table_row_map_with_header_on_wo_queue_table( "Work Order", woName) self.woQueueTbl._click_table_cell(returnRow, 1) self.editBtn.click_enabled_element() driver.unselect_frame()
def edit_layout_reports(self, sourcePane, destinationPane, items, destinationItem, delimiter=","): """'sourcePane': HeaderFooterLeft, ContentLeft, Header, Content, Footer ... 'destinationPane': Header, Content, Footer, HeaderFooterLeft, ContentLeft ... 'items': one or many items. Each item can be unique item or expanded items (ex: items=Rack,Configuration->Port Configuration,Configuration->Service 01) ... 'destinationItem': the position you want to drop""" self._select_iframe(self.uniqueIframe, self.editLayoutHeaderFooterLeftDiv) sourcePaneXpath = self.define_layout_pane_xpath(sourcePane) destinationPaneXpath = self.define_layout_pane_xpath(destinationPane) destinationElement = self.build_layout_item_element(destinationPaneXpath, "Destination", destinationItem) listItem = items.split(delimiter) for item in listItem: isEpandedItemExisted = "->" in item if isEpandedItemExisted: sourceElement = self.return_expand_layout_item(sourcePaneXpath, item) sourceElement.wait_until_element_is_visible() sourceElement.mouse_over() sourceElement.drag_and_drop(destinationElement.locator()) else: sourceElement = self.build_layout_item_element(sourcePaneXpath, "Source", item) sourceElement.drag_and_drop(destinationElement.locator()) driver.unselect_frame()
def expand_wo_in_wo_history(self, woName, currentStatus): self._select_iframe(self.woHistoryIframe, self.woHistoryTbl) inputValues = woName + "," + currentStatus returnRow = self._get_table_row_map_with_header_on_wo_history_table( "Work Order,Current Status", inputValues) self.woHistoryTbl._click_table_cell(returnRow, 1, "double") driver.unselect_frame()
def check_object_exist_on_combo_box_filter(self, label, objects, delimiter=","): self._select_iframe(self.uniqueIframe, self.locationTreeDiv) listObject = objects.split(delimiter) for i in listObject: self.dynamicComboboxFilter.arguments = [label, i] SeleniumAssert.element_should_be_visible(self.dynamicComboboxFilter) driver.unselect_frame()
def check_wo_history_information(self, woName, currentStatus): self._select_iframe(self.woHistoryIframe, self.woHistoryTbl) inputValues = woName + "," + currentStatus returnRow = self._get_table_row_map_with_header_on_wo_history_table( "Work Order,Current Status", inputValues) Assert.should_be_true(returnRow > 0) driver.unselect_frame()
def check_tree_node_check_box_not_exist_on_select_filter(self, path, delimiter="/"): self._select_iframe(self.uniqueIframe, self.locationTreeDiv) self.locationTreeDiv.mouse_over() isExisted = self.locationTreeDiv.does_tree_node_checkbox_exist(path, delimiter) Assert.should_be_equal(isExisted, False, "This tree node checkbox exists") driver.unselect_frame()
def _check_event_details(self, eventDetails, eventDescription, eventDateTime=None, position=1, delimiter="/"): textDetailsList = eventDetails.split(delimiter) detailsXpath = self.detailsBridgeXpath.locator() eventPos = self._build_event_xpath(eventDescription, eventDateTime, position) self.secondIframe.wait_until_page_contains_element() self._select_iframe(self.secondIframe, self.eventLogTbl) self.selectItemCbb.wait_until_element_is_visible() self.selectItemCbb.select_from_list_by_label(1000) self._expand_events() for text in textDetailsList: subDetails = detailsXpath self.dynamicTextXpath.arguments = [text] strTextXpath = self.dynamicTextXpath.locator() detailsXpath = subDetails + strTextXpath fullDetailsXpath = eventPos.locator() + detailsXpath SeleniumAssert.element_should_be_visible(Element(fullDetailsXpath)) driver.unselect_frame()
def edit_event_notification_profile(self, profileName, profileDescription=None, events=None, locationPath=None, integrationService=None, sendEmail=None, emailServer=None, recipients=None, submit=True, delimiter="/"): self._select_iframe(self.uniqueIframe, self.addBtn) eventRow = self.profileTbl._get_table_row_map_with_header( "Name", profileName, ",") self.profileTbl._click_table_cell(eventRow, 1) administration.editBtn.click_visible_element() self.eventProfileNameTxt.wait_until_element_is_visible() if profileDescription is None: self.nextStep1Btn.click_visible_element() self._wait_for_processing() self.profileEventsTbl.wait_until_element_is_visible() driver.unselect_frame() else: driver.unselect_frame() self.fill_event_notification_profile(None, profileDescription, events, locationPath, integrationService, sendEmail, emailServer, recipients, delimiter) if submit: self.submit_event_notification_profile(profileName)
def collapse_layout_items_on_content_left(self, items, delimiter=","): self._select_iframe(self.uniqueIframe, self.editLayoutHeaderFooterLeftDiv) paneXpath = self.define_layout_pane_xpath("ContentLeft") listItem = items.split(delimiter) for item in listItem: self.toggle_layout_item_expand_state(paneXpath, item, "collapse") driver.unselect_frame()
def set_priority_event_checkbox(self, event, value=True): self._select_iframe(self.uniqueIframe, self.eventsTbl) self.dynamicPriorityChk.arguments = [event] self.dynamicPriorityChk.select_checkbox(value) administration.saveBtn.click_visible_element() driver.unselect_frame() self.confirmDialogBtn.click_visible_element() self.confirmDialogBtn.wait_until_element_is_not_visible()
def delete_report (self, reportName): self._select_iframe(self.uniqueIframe, self.reportTbl) returnRow = self.reportTbl._get_table_row_map_with_header("Name", reportName) if (returnRow != 0): self.reportTbl._click_table_cell(returnRow, 1) report.deleteBtn.click_visible_element() self.dialogYesBtn.click_visible_element() driver.unselect_frame()
def check_task_list_information_on_work_order_queue_window( self, position, name, taskType, treeFrom, connectionType, treeTo): self._select_iframe(workOrders.woQueueIframe, self.markCompleteBtn) workOrders._check_task_list_information(self.woQueueGridIframe, position, name, taskType, treeFrom, connectionType, treeTo) driver.unselect_frame()
def _locate_event(self, eventDescription, eventDateTime=None, position=1): eventPos = self._build_event_xpath(eventDescription, eventDateTime, position) self._select_iframe(self.secondIframe, self.refreshBtn) eventPos.click_element() self.locateBtn.click_visible_element() self._wait_for_processing() driver.unselect_frame()
def edit_user_information(self, username, technician): self._select_iframe(self.uniqueIframe, self.userTbl) returnRow = self.get_table_row_map_with_header_on_user_table( "Username", username) self.userTbl._click_table_cell(returnRow, 1) administration.editBtn.click_visible_element() self.technicianChk.select_checkbox(technician) self.confirmDialogBtn.click_visible_element() driver.unselect_frame()
def check_event_not_exist_on_event_notification_profiles_page( self, eventNames, delimiter=","): self._select_iframe(self.uniqueIframe, self.profileEventsTbl) listEventNames = eventNames.split(delimiter) for eventName in listEventNames: eventRow = self.profileEventsTbl._get_table_row_map_with_header( "Name", eventName, ",") Assert.should_be_true(eventRow == 0, eventName + " exists") driver.unselect_frame()
def decommission_server(self, typeRemove="1", removeServer=True): """typeRemove: 1,2,3""" self._select_iframe(services.serviceIframe, self.removeServerChk) self._wait_for_processing() self.dynamicRemoveConnectRadio.arguments = [typeRemove] self.dynamicRemoveConnectRadio.select_radio_button("RemoveOption", typeRemove) self.removeServerChk.select_checkbox(removeServer) driver.unselect_frame() self.confirmDialogBtn.click_visible_element()