def switch_tab(self,title,tabName): """ #Details Page Switch Tab :param:title, tabName :return: """ if self.is_details_page(title) == True: self.find_element_by_wait("xpath", LandCommonEntity().get_record_tab(tabName)) self.click(LandCommonEntity().get_record_tab(tabName))
def SaleDetails(self, multiTractSaleIndicator, reservationEasement): self.ctrl_all(LandCommonEntity().get_field_input("minimumBidAmount")) self.type(LandCommonEntity().get_field_input("minimumBidAmount"), BasePage(self.driver).randomData("number", 2)) self.ctrl_all( LandCommonEntity().get_field_textarea("multiTractComment")) self.type(LandCommonEntity().get_field_textarea("multiTractComment"), BasePage(self.driver).randomData("string", 6)) self.drop_select(LandCommonEntity().get_field_select("multiTractSale"), multiTractSaleIndicator) self.ctrl_all(LandCommonEntity().get_field_input("nearestCommunity")) self.type(LandCommonEntity().get_field_input("nearestCommunity"), BasePage(self.driver).randomData("string", 6)) self.drop_select( LandCommonEntity().get_field_select("reservationEasementRequired"), reservationEasement) reservations_list = self.find_elements(LandDetailsEntity.reservations) rows = random.sample(range(1, len(reservations_list)), 3) for i in rows: self.click(LandDetailsEntity().get_reservation(i)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def utilities(self, utilityType): self.drop_select(LandCommonEntity().get_field_select("propertyClass"), utilityType) self.ctrl_all(LandCommonEntity().get_textarea_specail("note")) self.type(LandCommonEntity().get_textarea_specail("note"), BasePage(self.driver).randomData("string", 6)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def comments(self, commentClass): self.drop_select(LandCommonEntity().get_field_select("commentClass"), commentClass) self.ctrl_all(LandCommonEntity().get_field_textarea("comment")) self.type(LandCommonEntity().get_field_textarea("comment"), BasePage(self.driver).randomData("string", 6)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def counties(self, county, state): self.drop_select(LandCommonEntity().get_field_select("name"), county) self.drop_select(LandCommonEntity().get_field_select("state"), state) self.ctrl_all(LandCommonEntity().get_field_input("acres")) self.type(LandCommonEntity().get_field_input("acres"), BasePage(self.driver).randomData("number", 3)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def encumbrance(self, encumbranceClass): self.drop_select( LandCommonEntity().get_field_select("encumbranceClass"), encumbranceClass) self.ctrl_all(LandCommonEntity().get_textarea_specail("description")) self.type(LandCommonEntity().get_textarea_specail("description"), BasePage(self.driver).randomData("string", 6)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def utilization(self, utilizationClass, utilizationType): self.drop_select(LandCommonEntity().get_field_select("propertyClass"), utilizationClass) self.drop_select(LandCommonEntity().get_field_select("type"), utilizationType) self.ctrl_all(LandCommonEntity().get_field_input("percent")) self.type(LandCommonEntity().get_field_input("percent"), BasePage(self.driver).randomData("number", 2)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def top_operate(self,title,buttonName,acitonName): """ # Action Drop List :param : title,buttonName,acitonName :return: """ #self.scroll_into_view(CustomerRecordEntity().get_customer_operate(buttonName)) if self.is_details_page(title) == True: self.click(LandCommonEntity().get_top_operate(buttonName)) if buttonName == "Actions ": self.click(LandCommonEntity().get_actions(acitonName)) if acitonName == "Delete": self.delete()
def choose_button(self,sectionName,buttonName): """ #The Edit, History button on Location tab, Characteristics tab,Survey tab :param: sectionName,buttonName :return: """ if sectionName in ("Location From County Seat", "Characteristics", "Disposition Plan"): self.click(LandCommonEntity().get_left_button(buttonName)) elif sectionName in ("Location", "Management"): self.click(LandCommonEntity().get_right_button(1, buttonName)) elif sectionName in ("Uplands"): self.click(LandCommonEntity().get_right_button(2, buttonName)) elif sectionName in ("Land Survey"): self.click(LandCommonEntity().get_survey_button(buttonName))
def summary_field_list(self,sectionName): """ #The fields value on Location tab, Characteristics tab,Survey tab :param: sectionName :return: """ if sectionName in ("Location From County Seat", "Characteristics"): summary_field_list = self.find_elements(LandCommonEntity().get_field_list("col-md-5",1,1)) elif sectionName in ("Disposition Plan"): summary_field_list = self.find_elements(LandCommonEntity().get_field_list("col-md-5", 1, 2)) elif sectionName in ("Location", "Management"): summary_field_list = self.find_elements(LandCommonEntity().get_field_list("col-md-7", 1, 1)) elif sectionName in ("Uplands"): summary_field_list = self.find_elements(LandCommonEntity().get_field_list("col-md-7", 2, 2)) elif sectionName in ("Land Survey"): summary_field_list = self.find_elements(LandCommonEntity().get_field_list("col-md-12", 1, 1)) return summary_field_list
def is_details_page(self,title): """ #Details Page :param:title :return: """ if self.find_element(LandCommonEntity().get_default_text(title)): return True else: return False
def EventCalendar(self, eventType): self.ctrl_all(LandCommonEntity().get_field_input("eventDate")) self.type(LandCommonEntity().get_field_input("eventDate"), CurrentDate) self.enter(LandCommonEntity().get_field_input("eventDate")) self.ctrl_all(LandCommonEntity().get_field_input("eventName")) self.type(LandCommonEntity().get_field_input("eventName"), BasePage(self.driver).randomData("string", 6)) self.drop_select(LandCommonEntity().get_field_select("eventType"), eventType) self.ctrl_all(LandCommonEntity().get_field_textarea("description")) self.type(LandCommonEntity().get_field_textarea("description"), BasePage(self.driver).randomData("string", 6)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def required_validation(self): """ #validate the required fields :param: :return: """ self.sleep(1) expect_message_list = [] actual_message_list = [] for i in range(1,len(self.find_elements(LandCommonEntity.field_section))+1): for j in range(1,len(self.find_elements(LandCommonEntity().get_fields_of_section(i)))+1): if self.exist_element(LandCommonEntity().get_required_name(i,j)) != False: if self.find_element(LandCommonEntity().get_fields_name(i,j)).text.rstrip( '*') in ("Encumbrance Class","State"): pass else: expect_message_list.append((self.find_element(LandCommonEntity().get_fields_name(i,j)).text).rstrip( '*') + " is required.") print("!!!!!") print(expect_message_list) print("!!!!!") self.sleep(1) self.click(LandCommonEntity().get_land_button("Save")) actual_error_list = self.find_elements(LandCommonEntity.required_field_message) for i,item in enumerate(actual_error_list): value = item.text actual_message_list.append(value) print("#####") print(actual_message_list) print("#####") # self.sleep(1) # if flag == 1: # self.execute_script_click(LandCommonEntity.close) # else: # self.execute_script_click(LandCommonEntity().get_land_button("Cancel")) if actual_message_list == expect_message_list: return True else: return False
def not_selected(self,section,row): """ # Not selected record :param : section :param : row :return: """ selected = self.find_element( LandCommonEntity().get_select_record(section, row)).get_attribute('style') if "background" in selected: pass else: return True
def list_operation(self,title,sectionName,buttonName,row,textarea): """ #Tabs :param:title,sectionName,buttonName,row,textarea :return: """ if self.is_details_page(title) == True: section_list = self.find_elements(LandCommonEntity.section_list) # print(section_list) section_item = None for i, item in enumerate(section_list): if sectionName == item.text: section_item = (i + 1, item) break if section_item is None: logger.info(msg="sectionName %s not found!" % sectionName) else: # self.scroll_into_view(LandDetailsEntity().get_section_name(sectionName)) if buttonName in ("New", "Relate"): pass elif self.exist_element(LandCommonEntity().get_section_records(section_item[0])): if self.not_selected(section_item[0], row) == True: self.click(LandCommonEntity().get_select_record(section_item[0], row)) if buttonName in ("Details", "History"): table_field_value = [] table_column_list = self.find_elements(LandCommonEntity().get_column_value(section_item[0], row)) for i, item in enumerate(table_column_list): value = item.text table_field_value.append(value) print("#####") print(table_field_value) print("#####") self.click(LandCommonEntity().get_section_operator(section_item[0], buttonName)) dialog_field_value = [] if buttonName == "Details": input_list = self.find_elements(LandCommonEntity.input_value) for a, item in enumerate(input_list): value = item.get_attribute('value') dialog_field_value.append(value) if textarea == 1: for b, item in enumerate(self.find_elements(LandCommonEntity.textarea_value)): value = item.text dialog_field_value.append(value) else: history_column_list = self.find_elements(LandCommonEntity().get_history_value(row)) for a, item in enumerate(history_column_list): value = item.text dialog_field_value.append(value) print("!!!!") print(dialog_field_value) print("!!!!") self.sleep(2) self.execute_script_click(LandCommonEntity.close) if set(table_field_value) < set(dialog_field_value) or set(dialog_field_value) < set(table_field_value) or table_field_value == dialog_field_value: return True else: return False self.click(LandCommonEntity().get_section_operator(section_item[0], buttonName))
def interest(self, interestClass, interestStatus): self.drop_select(LandCommonEntity().get_field_select("class"), interestClass) self.ctrl_all(LandCommonEntity().get_field_input("percent")) self.type(LandCommonEntity().get_field_input("percent"), BasePage(self.driver).randomData("number", 2)) self.drop_select(LandCommonEntity().get_field_select("status"), interestStatus) self.ctrl_all(LandCommonEntity().get_field_textarea("comment")) self.type(LandCommonEntity().get_field_textarea("comment"), BasePage(self.driver).randomData("string", 6)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def location(self, legalAccessIndicator, withinCityIndicator): self.ctrl_all(LandCommonEntity().get_input_special("street1")) self.type(LandCommonEntity().get_input_special("street1"), BasePage(self.driver).randomData("string", 6)) self.ctrl_all(LandCommonEntity().get_textarea_specail("directions")) self.type(LandCommonEntity().get_textarea_specail("directions"), BasePage(self.driver).randomData("string", 6)) self.drop_select(LandCommonEntity().get_field_select("legalAccess"), legalAccessIndicator) self.drop_select(LandCommonEntity().get_field_select("withinCity"), withinCityIndicator) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def locationCountySeat(self, directionFromCountySeat, deviationFromCountySeat): self.drop_select(LandCommonEntity().get_field_select("direction"), directionFromCountySeat) self.ctrl_all(LandCommonEntity().get_input_special("distance")) self.type(LandCommonEntity().get_input_special("distance"), BasePage(self.driver).randomData("number", 1)) self.drop_select(LandCommonEntity().get_field_select("deviation"), deviationFromCountySeat) self.ctrl_all(LandCommonEntity().get_input_special("degree")) self.type(LandCommonEntity().get_input_special("degree"), BasePage(self.driver).randomData("number", 1)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def characteristics(self, improvementsIndicator, utilitiesAvailableIndicator): self.drop_select( LandCommonEntity().get_field_select("hasImprovements"), improvementsIndicator) self.ctrl_all(LandCommonEntity().get_input_special("topography")) self.type(LandCommonEntity().get_input_special("topography"), BasePage(self.driver).randomData("string", 6)) self.drop_select( LandCommonEntity().get_field_select("utilitiesAvailable"), utilitiesAvailableIndicator) self.ctrl_all(LandCommonEntity().get_input_special("zoning")) self.type(LandCommonEntity().get_input_special("zoning"), BasePage(self.driver).randomData("string", 6)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def dispositionPlan(self, flag, dispositionAttribute): if flag == 1: self.drop_select( LandCommonEntity().get_field_select("attributes1"), dispositionAttribute) self.type(LandCommonEntity().get_input_special("comment1"), BasePage(self.driver).randomData("string", 6)) self.drop_select( LandCommonEntity().get_field_select("attributes2"), dispositionAttribute) self.type(LandCommonEntity().get_input_special("comment2"), BasePage(self.driver).randomData("string", 6)) else: self.drop_select(LandCommonEntity().get_field_select("attributes"), dispositionAttribute) self.ctrl_all(LandCommonEntity().get_textarea_specail("comment")) self.type(LandCommonEntity().get_textarea_specail("comment"), BasePage(self.driver).randomData("string", 6)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def summary_operation(self,title,sectionName,buttonName,row,textarea): """ #Location tab, Characteristics tab,Survey tab :param:title,sectionName,buttonName,row,textarea :return: """ if self.is_details_page(title) == True: if sectionName in ("Location From County Seat", "Location", "Characteristics", "Management", "Uplands", "Survey"): if buttonName == "History": summay_value_list = [] summary_field_list = self.summary_field_list(sectionName) for a, item in enumerate(summary_field_list): value = item.get_attribute('value') summay_value_list.append(value) print("#####") print(summay_value_list) print("#####") self.choose_button(sectionName,buttonName) history_value_list = [] history_column_list = self.find_elements(LandCommonEntity().get_history_value(row)) for a, item in enumerate(history_column_list): value = item.text history_value_list.append(value) print("!!!!") print(history_value_list) print("!!!!") self.sleep(2) self.execute_script_click(LandCommonEntity.close) if set(summay_value_list) < set(history_value_list) or set(history_value_list) < set( summay_value_list) or summay_value_list == history_value_list: return True else: return False self.sleep(2) self.choose_button(sectionName,buttonName) self.sleep(2) else: section_list = self.find_elements(LandCommonEntity.section_list) # print(section_list) section_item = None for i, item in enumerate(section_list): if sectionName == item.text: section_item = (i + 1, item) break if section_item is None: logger.info(msg="sectionName %s not found!" % sectionName) else: # self.scroll_into_view(LandDetailsEntity().get_section_name(sectionName)) if buttonName in ("New"): pass elif self.exist_element(LandCommonEntity().get_section_records(section_item[0]+1)): if self.not_selected(section_item[0]+1, row) == True: self.click(LandCommonEntity().get_select_record(section_item[0]+1, row)) if buttonName in ("Details", "History"): table_field_value = [] table_column_list = self.find_elements(LandCommonEntity().get_column_value(section_item[0]+1, row)) for i, item in enumerate(table_column_list): value = item.text table_field_value.append(value) print("#####") print(table_field_value) print("#####") self.click(LandCommonEntity().get_section_button(section_item[0]+1, buttonName)) dialog_field_value = [] if buttonName == "Details": input_list = self.find_elements(LandCommonEntity.input_value) for a, item in enumerate(input_list): value = item.get_attribute('value') dialog_field_value.append(value) if textarea == 1: for b, item in enumerate(self.find_elements(LandCommonEntity.textarea_value)): value = item.text dialog_field_value.append(value) else: history_column_list = self.find_elements(LandCommonEntity().get_history_value(row)) for a, item in enumerate(history_column_list): value = item.text dialog_field_value.append(value) print("!!!!") print(dialog_field_value) print("!!!!") self.sleep(2) self.execute_script_click(LandCommonEntity.close) if set(table_field_value) < set(dialog_field_value) or set(dialog_field_value) < set(table_field_value) or table_field_value == dialog_field_value: return True else: return False self.click(LandCommonEntity().get_section_button(section_item[0]+1, buttonName))
def ExcessAcreage(self, countyName, mineralsSoldIndicator, prefix, suffix): self.ctrl_all(LandCommonEntity().get_field_input("applicationDate")) self.type(LandCommonEntity().get_field_input("applicationDate"), currentDate) self.enter(LandCommonEntity().get_field_input("applicationDate")) self.ctrl_all(LandCommonEntity().get_field_input("appraisalDate")) self.type(LandCommonEntity().get_field_input("appraisalDate"), currentDate) self.enter(LandCommonEntity().get_field_input("appraisalDate")) self.ctrl_all(LandCommonEntity().get_field_input("excessAcres")) self.type(LandCommonEntity().get_field_input("excessAcres"), BasePage(self.driver).randomData("number", 2)) self.ctrl_all( LandCommonEntity().get_field_input("excessAcresAppliedToPurchase")) self.type( LandCommonEntity().get_field_input("excessAcresAppliedToPurchase"), BasePage(self.driver).randomData("string", 6)) self.ctrl_all(LandCommonEntity().get_field_input("proRataShare")) self.type(LandCommonEntity().get_field_input("proRataShare"), BasePage(self.driver).randomData("number", 2)) self.ctrl_all(LandCommonEntity().get_field_input("appraisalValue")) self.type(LandCommonEntity().get_field_input("appraisalValue"), BasePage(self.driver).randomData("number", 3)) self.ctrl_all(LandCommonEntity().get_field_input("purchaseAmount")) self.type(LandCommonEntity().get_field_input("purchaseAmount"), BasePage(self.driver).randomData("number", 3)) self.ctrl_all(LandCommonEntity().get_field_input("mineralPerAcre")) self.type(LandCommonEntity().get_field_input("mineralPerAcre"), BasePage(self.driver).randomData("number", 3)) self.ctrl_all(LandCommonEntity().get_field_input("mineralTotal")) self.type(LandCommonEntity().get_field_input("mineralTotal"), BasePage(self.driver).randomData("number", 3)) self.ctrl_all(LandCommonEntity().get_field_input("surfacePerAcre")) self.type(LandCommonEntity().get_field_input("surfacePerAcre"), BasePage(self.driver).randomData("number", 3)) self.ctrl_all(LandCommonEntity().get_field_input("surfaceTotal")) self.type(LandCommonEntity().get_field_input("surfaceTotal"), BasePage(self.driver).randomData("number", 3)) self.ctrl_all(LandCommonEntity().get_field_input("applicantName")) self.type(LandCommonEntity().get_field_input("applicantName"), BasePage(self.driver).randomData("string", 6)) self.drop_select(LandCommonEntity().get_field_select("countyName"), countyName) self.drop_select( LandCommonEntity().get_field_select("mineralsSoldIndicator"), mineralsSoldIndicator) self.drop_select( LandCommonEntity().get_field_select("baseFiles.0.filePrefix"), prefix) self.drop_select( LandCommonEntity().get_field_select("baseFiles.0.fileSuffix"), suffix) self.ctrl_all( LandCommonEntity().get_field_input("baseFiles.0.fileNumber")) self.type(LandCommonEntity().get_field_input("baseFiles.0.fileNumber"), BasePage(self.driver).randomData("number", 6)) self.ctrl_all( LandCommonEntity().get_field_input("baseFiles.0.fileAppendAge")) self.type( LandCommonEntity().get_field_input("baseFiles.0.fileAppendAge"), BasePage(self.driver).randomData("number", 3)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def Acquisition(self, acquisitionClass, acquisitionMethod): self.ctrl_all(LandCommonEntity().get_field_input("acquisitionDate")) self.type(LandCommonEntity().get_field_input("acquisitionDate"), currentDate) self.enter(LandCommonEntity().get_field_input("acquisitionDate")) self.ctrl_all(LandCommonEntity().get_field_input("cost")) self.type(LandCommonEntity().get_field_input("cost"), BasePage(self.driver).randomData("number", 2)) self.ctrl_all(LandCommonEntity().get_field_input("expenses")) self.type(LandCommonEntity().get_field_input("expenses"), BasePage(self.driver).randomData("number", 2)) self.drop_select(LandCommonEntity().get_field_select("classProperty"), acquisitionClass) self.drop_select(LandCommonEntity().get_field_select("methodProperty"), acquisitionMethod) self.ctrl_all(LandCommonEntity().get_field_input("namecurrent")) self.type(LandCommonEntity().get_field_input("namecurrent"), BasePage(self.driver).randomData("string", 6)) self.ctrl_all(LandCommonEntity().get_field_input("nameoriginal")) self.type(LandCommonEntity().get_field_input("nameoriginal"), BasePage(self.driver).randomData("string", 6)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False
def Appraisal(self,source,estimatedValueMethod): self.ctrl_all(LandCommonEntity().get_field_input("appraisalDate")) self.type(LandCommonEntity().get_field_input("appraisalDate"),currentDate) self.enter(LandCommonEntity().get_field_input("appraisalDate")) self.ctrl_all(LandCommonEntity().get_field_input("appraisedAcres")) self.type(LandCommonEntity().get_field_input("appraisedAcres"), BasePage(self.driver).randomData("number", 2)) self.ctrl_all(LandCommonEntity().get_field_input("totalMarketValue")) self.type(LandCommonEntity().get_field_input("totalMarketValue"), BasePage(self.driver).randomData("number", 2)) self.ctrl_all(LandCommonEntity().get_field_input("landValue")) self.type(LandCommonEntity().get_field_input("landValue"), BasePage(self.driver).randomData("number", 2)) self.ctrl_all(LandCommonEntity().get_field_input("buildingValue")) self.type(LandCommonEntity().get_field_input("buildingValue"), BasePage(self.driver).randomData("number", 2)) self.ctrl_all(LandCommonEntity().get_field_input("improvementValue")) self.type(LandCommonEntity().get_field_input("improvementValue"), BasePage(self.driver).randomData("number", 2)) self.ctrl_all(LandCommonEntity().get_field_input("appraisalNumber")) self.type(LandCommonEntity().get_field_input("appraisalNumber"), BasePage(self.driver).randomData("number", 2)) self.drop_select(LandCommonEntity().get_field_select("source"), source) self.drop_select(LandCommonEntity().get_field_select("methodProperty"),estimatedValueMethod) self.ctrl_all(LandCommonEntity().get_field_input("mineralValue")) self.type(LandCommonEntity().get_field_input("mineralValue"),BasePage(self.driver).randomData("number", 2)) self.click(LandCommonEntity().get_land_button("Save")) if 'successfully' in LandCommonPage(self.driver).get_tips_msg(): return True else: return False