from selenium.webdriver.common.by import By from base.WebKeys import WebKeys class DelChapter(WebKeys): def del_chapter(self): self.locator_with_wait(By.XPATH,'//*[@class="book_list"]//td/a[2]').click() self.locator_with_wait(By.LINK_TEXT,"确定").click() # 找到所有的书 ele=self.locators_with_wait(By.XPATH,'//*[@id="bookList"]//td[1]') name_list=[] for i in ele: name_list.append(i.text) return name_list