def get_table_content(self, driver, value_num): arr = [] arr1 = [] try: # 按行查询表格的数据,取出的数据是一整行,按空格分隔每一列的数据 table_tr_list = driver.find_element(*self.table_loc).find_elements(By.TAG_NAME, "tr") time.sleep(5) for tr in table_tr_list: # result = unicode(tr.text, 'GBK').encode('UTF-8') arr1 = (tr.text).split(" ") # 以空格拆分成若干个(个数与列的个数相同)一维列表 arr.append(arr1) # 将表格数据组成二维的列表 except Exception as e: print(e) # 循环遍历table数据,确定查询数据的位置 for i in range(len(arr)): tip_num = value_num[i] for j in range(len(arr[i])): print(arr[i][j]) input_xpath = (By.XPATH, '//*[@id="390dd8f4-8405-4f64-a260-230a0e54b619-non-body"]/tbody/tr[j]/td[i+1]/input') BasePage.text_sender(self, input_xpath, tip_num[j]) time.sleep(5)
def cargo_is_null(self): return BasePage.is_null(self, self.cargoType_loc)
def product_is_null(self): return BasePage.is_null(self, self.product_loc)
def name_is_null(self): return BasePage.is_null(self, self.customerName_loc)
def waybill_is_null(self): return BasePage.is_null(self, self.waybillNo_loc)
def save_click(self): BasePage.button_click(self, self.save_loc)
def subweight_enter(self, weight): BasePage.text_enter(self, self.subweight_loc, weight)
def cus_code_enter(self, cus_code): BasePage.text_enter(self, self.customerCode_loc, cus_code)
def remark_write(self, remark): BasePage.text_enter(self, self.remark_loc, remark)
def pieces_enter(self, pieces): BasePage.text_enter(self, self.pieces_loc, pieces)
def waybill_send(self, waybill): BasePage.text_sender(self, self.waybillNo_loc, waybill)
def waybill_enter(self, waybill): BasePage.text_enter(self, self.waybillNo_loc, waybill)
def cargotype_select(self, index): BasePage.index_select(self, self.cargoType_loc, index)
def product_select(self, index): BasePage.index_select(self, self.product_loc, index)
def cus_name_enter(self, cus_name): BasePage.text_enter(self, self.customerName_loc, cus_name)
def pieces_is_null(self): return BasePage.is_null(self, self.pieces_loc)
def allweight_is_null(self): return BasePage.is_null(self, self.allweight_loc)
def subwaybill_enter(self, sub_waybill): BasePage.text_enter(self, self.subwaybill_loc, sub_waybill)