Skip to content Skip to sidebar Skip to footer

Selenium : Unable To Put Scraped Elements To Csv

I have successfully scraped the data from the site. Well it's returning me error. I used 'Title1' : pd.Series([ ele for ele.text in elements ]) for storing data to csv file, but r

Solution 1:

This method .text() is simply used to fetch an array/list of elements. In this line for example,

elements = driver.find_elements_by_css_selector(x)

This is why your loop pd.Series([ ele for ele.text in elements ]), fails, and so removing the text runs fine as expected.

So change this

pd.Series([ ele for ele.text in elements ])

to this

pd.Series([ ele.text for ele in elements ])

This means that it would first obtain ele first in elements and within that obtain the text attribute of the ele.

Post a Comment for "Selenium : Unable To Put Scraped Elements To Csv"