It is happing most probably due to our script getting the options button from the previous chat and then the next chat loaded but we are trying to click on an element from the previous chat's button
So, to fix it we need to use the _wait_for_an_element_to_deattached for the options button from the previous chat or maybe in some other way
Following error
Traceback (most recent call last):
File "E:\ee\tithiwa\tithiwa\temp\test.py", line 41, in <module>
tithiwabot.clear_all_chats()
File "E:\ee\tithiwa\tithiwa\chatroom.py", line 71, in clear_all_chats
self._wait_for_presence_of_an_element(SELECTORS.CHATROOM__OPTIONS).click()
..etc
File "C:\Users\ee\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
(Session info: chrome=95.0.4638.69)
It is happing most probably due to our script getting the options button from the previous chat and then the next chat loaded but we are trying to click on an element from the previous chat's button
So, to fix it we need to use the
_wait_for_an_element_to_deattached
for the options button from the previous chat or maybe in some other wayFollowing error