I am using selenium to scrape a dynamic website. My problem is that I can't scroll down to the items I am looking for. First, I made a list of those items I want to get information from (python_button1). I have to click on each item in this list to see a new window, in which I want to scrape them. Then I made a loop to click on those items. After that, I close the window I opened. Unfortunately, I can't scroll down to each item to click them. I used the following code but it scrolls down to the last item and skips other items. I would really appreciate if you can help me. Thanks!
python_button1 = driver.find_elements_by_class_name('simboloEvento')
for x in python_button1:
x.click()
time.sleep(2)
driver.find_element_by_class_name('cerrarBoton').click()
driver.execute_script("coordinates=arguments[0].
getBoundingClientRect();scrollTo( coordinates.x,coordinates.y);", x)
time.sleep(2)
innerHTML = driver.execute_script("return document.body.innerHTML")
print(innerHTML)
the scroll down list is a JavaScript Object. I have to click on each of those objects to activate the javascript function ( a new window). I can activate those objects via my code, but the problem is when at least one of those items are not in the current screen. That's why I should scroll down to that object ( here x) first to be able to click on it. But I don't know how to scroll down to that object. I have used the code I used in this post as well as this one : driver.execute_script("arguments[0].scrollIntoView();", x) but none of them worked for me!