wait=WebDriverWait(driver, 10)
driver.get('https://www.itftennis.com/en/tournament-calendar/mens-world-tennis-tour-calendar/?startdate=2021-10')
##wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "#onetrust-close-btn-container > button"))).click()
titles=wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, "a[href*='/en/tournament/m']")))
for title in titles:
print(title.get_attribute("href"))
通常,我们等待所有元素弹出,然后获取属性href
进口
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
通常,我们等待所有元素弹出,然后获取属性href
进口
输出
相关问题 更多 >
编程相关推荐