【发布时间】:2021-06-21 18:17:52
【问题描述】:
HTML我正在关注关于通过 selenium 抓取 glassdoor 网站的在线教程。 我的代码没有通过这个语句:
try:
driver.find_element_by_class_name("selected").click()
print('x out worked')
except ElementClickInterceptedException:
print('x out failed')
pass
time.sleep(.1)
try:
driver.find_element_by_css_selector('[alt="Close"]').click()
print(' x out worked')
except NoSuchElementException:
print(' x out failed (next page or missing)')
pass
我收到的错误是:
NoSuchElementException: 消息:没有这样的元素:无法找到元素:{"method":"css selector","selector":".selected"}
我尝试过的几件事:
- driver.maximize_window()
- driver.implicitly_wait(20)
【问题讨论】:
标签: selenium web-scraping