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()
Why do I still get 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?
I have imported the NoSuchElementException from selenium.common.exceptions.