我似乎找不到适合我所要做的事情的Xpath:
我尝试单击的元素似乎是:
//*[@id="react-autowhatever-1--item-0"]/span/div[2]
但当运行此代码时:
wait = WebDriverWait(imdbScrape.driver, 10)
wait.until(ec.element_to_be_clickable((By.XPATH,
'//*[@id="suggestion-search"]'))).send_keys("the"
+ "fifth element")
searchBar = wait.until(ec.element_to_be_clickable((By.XPATH,
'//*[@id="react-autowhatever-1--item-0"]/span/div[2]')))
searchBar.location_once_scrolled_into_view
urlToScrape = searchBar.get_attribute("href")
print(urlToScrape)
我得到“无”作为结果,我假设这是因为当我在网页上看,我没有看到任何“href”标签,但我想知道如何才能得到第一个选择的链接地址
任何帮助都将不胜感激
谢谢你
目前没有回答
相关问题 更多 >
编程相关推荐