I’m trying to get info from the following site, using python and selenium:
https://conveniomarco.mercadopublico.cl/alimentos/marketplace/seller/profile/shop/797095-5800279
It has two sections:
“Condiciones Comerciales” and
“Condiciones Regionales”
I need to put all the tables of the section “Condiciones Regionales” in a dataframe, including the title that is outside of the table.
I can the all the tables info using the following code:
html=driver.find_element(By.CSS_SELECTOR, "body").get_attribute('outerHTML')
pd.read_html(html)[0]...
pd.read_html(html)[2]
But with this way, I lose the title, like “Region de Coquimbo”, because this is not part of the table.
I’ve been trying to iterate over all the divs to get the title and then the inner table, with the following code:
condiciones_regionales=driver.find_element(By.CSS_SELECTOR, "div.wk_mp_design div.wk-mp-custom-regional div.wk-mp-profile-block div.wk-mp-aboutus-data div.box-regional-info")
condiciones=condiciones_regionales.find_elements(By.CSS_SELECTOR, "div.item")
item2=[]
for item2 in condiciones_regionales:
print(item2.text)
but I get an error: “‘WebElement’ object is not iterable”
How can I solve it?
Thanks