【发布时间】:2021-08-13 16:40:30
【问题描述】:
while True:
try:
browser.find_element_by_xpath('//*[@id="layoutPage"]/div[1]/div/div/div[3]/div[4]/div[2]/div/section/div[1]/div/button/div')
break
except NoSuchElementException:
browser.refresh()
为什么我仍然得到selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="layoutPage"]/div[1]/div/div/div[1]/div/div[1]/button[2]"} eroor?
我已经从 selenium.common.exceptions 导入了 NoSuchElementException。
【问题讨论】:
-
@saty035 不,它不回答这个问题
-
可以分享一下url或者html吗?