def get_norms_ele_text(self):elements=self.get_norms_elements()loc=By.CSS_SELECTOR,"div.sku-select-row-label"by = loc[0] # 获取By类型,例如By.CSS_SELECTORvalue = loc[1] # 获取具体的CSS选择器字符串,例如"div.sku-select-row-label"for element in elements:sub_element=element.find_element(by=by, value=value)text=self.get_text(sub_element)print(f"商品类型名:{text}")
可以这样。