我正在尝试访问类 =“TabLink_tab__uKOPj”的第二个链接
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import time
def go_to_url(driver, url):
driver.get(url)
#cookies accept
WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"button#onetrust-accept-btn-handler"))).click()
time.sleep(1)
pass
def main():
driver = webdriver.Firefox()
driver.maximize_window()
url = r"https://www.nba.com/games"
go_to_url(driver, url)
WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"class#TabLink_tab__uKOPj"))).select_by_index(1)
if __name__ == "__main__":
main()
这是我的代码的样子,附件是网页。如果您能提供帮助,我们将不胜感激。
附注我怎样才能更好地了解这样的 css 选择器