Selenium Web Scraping 电影的长度

Selenium Web Scraping lenght of a movie

我正在尝试使用网络抓取获取电影的长度,但它不起作用。

我有以下代码:

lenght = driver.find_element(By.CSS_SELECTOR,".sc-52284603-0 > li:nth-child(2)").text

但结果并不如预期。我得到 12 而不是 2h 56min 我不明白为什么因为我使用了正确的 cssselector

电影url = https://www.imdb.com/title/tt1877830/?ref_=watch_fanfav_tt_i_1

你快到了。应该是 .sc-52284603-0 > li:nth-child(3)

lenght = driver.find_element(By.CSS_SELECTOR,".sc-52284603-0 > li:nth-child(3)").text