I want to write a piece of code in Python that would click every result of a search and within each seperate result download all the files.
I'm trying to write a for loop that would iterate over the search results, however when I run the code it's not doing anything, neither throws an error. I am a newbie to Selenium and would appreciate if you could tell me where the problem lies, if it's the classes I'm using or the code itself.
First I open the search result window:
driver.get("https://dane.gov.pl/pl/dataset?page=1&per_page=100&q=&sort=-date&format%5Bterms%5D=csv&types%5Bterms%5D=file")
Closing a popup window:
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, "footer-close"))).click()
My for loop:
elements = driver.find_elements_by_class_name("result-item ng-star-inserted")
count = 0
for e in elements:
e.click()
for file in driver.find_element_by_class_name("ng-star-inserted"):
file.click()
count+=1
I'm not entirely sure if I'm using the correct class names, since the code doesn't open any link but there's no error.
The code can be easily run if selenium and drivers installed.