有點不清楚通過test = float(test[1:])行你到底想做什么。 然而,要從網站列表中提取所需的文本,您需要為visibility_of_element_located(誘導WebDriverWait,并且可以使用以下定位器策略: 代碼塊:options = webdriver.ChromeOptions() options.add_argument("start-maximized")driver = uc.Chrome(options=options)list1 = [6019306, 6049500, 6051161, 6022230, 5776662, 6151430]for x in range(0, len(list1)): try: url = 'https://www.axie.tech/axie-pricing/'+str(list1[x]) driver.get(url) print(WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, "http://span[text()='Reasonable']//following::div[1]//span[contains(@class, 'MuiTypography-root')]"))).text) excep