This is the code:
prices_parents = self.driver.find_elements(By.CSS_SELECTOR, ".mt-combination.mt-layout-block")
p_list = []
for parent in prices_parents:
prices = parent.find_elements(By.CSS_SELECTOR, "*")
for price in prices:
if price.get_attribute("data-column") == "lowestPrice":
p_list.append(price.text)
I get this error on the line with ".get_attribute":
Message: stale element reference: element is not attached to the page document
Since this code in executed ion a loop, I only rarely get the error (like once every 45min), but I need it to work every time.
How do I fix this?
