1 回答

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超6個(gè)贊
請(qǐng)測(cè)試這段代碼;請(qǐng)?jiān)黾拥却龝r(shí)間并使用 EC.presence_of_all_elements_ located 。
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
import os
options = Options()
options.headless = True
options.add_argument("window-size=1400,800")
options.add_argument("--no-sandbox")
options.add_argument("--disable-gpu")
options.add_argument("start-maximized")
options.add_argument("enable-automation")
options.add_argument("--disable-infobars")
options.add_argument("--disable-dev-shm-usage")
driver = webdriver.Chrome(options=options)
driver.get('https://paris-sportifs.pmu.fr/pari/sport/25/football')
odds = [my_elem.text for my_elem in WebDriverWait(driver, 50).until(EC.presence_of_all_elements_located((By.XPATH, '//a[contains(@href, "#")]')))]
print(odds, '\n')
添加回答
舉報(bào)