respectively on element is here:
With the following code, I expected to get an array of objects with all the relevant elements:
driver.get('https://www.booklooker.de/buecher-schnaeppchen')
time.sleep(3)
elements = driver.find_elements(By.CLASS_NAME, 'tooltip')
for test in elements:
test.click()
time.sleep(5)
If i run that code snippet, it doesn't work; that is, nothing happened.
How can I:
- get an array with the elements
- and how to loop through them?
CodePudding user response:
I believe that the space in your class name is not handled well by Selenium. What happens if you instead use:
elements = driver.find_elements(By.CSS_SELECTOR, '.articleRow.resultlist_productsproduct')