I am new in python and I am trying of obtain data about sold houses webpage. I need to click in each item (ad house), extract data of this, return initial webpage and click in another item....
In this moment it only print information of the first item and after get this error:
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document (Session info: chrome=77.0.3865.90)
I tried with try and except, but it only prints the first item.
element = driver.find_elements_by_class_name('title-grid')
for j in range(0,len(element)):
if element[j].is_displayed():
element[j].click()
product_containers = driver.find_elements_by_class_name('row.detailContent')
print(product_containers)
for container in product_containers:
price=container.find_element_by_class_name('price').text
#print(price)
prices.append(price)
j=j+1
driver.back()
time.sleep(15)