I want to click on the first 10 elements from the returned list below.
Currently, Selenium is clicking on all the elements but I want it to be limited to the first 10 clicks only.
How do I do this?
JavaScript
x
4
1
items1 = driver.find_elements_by_xpath("//div[@class='teams']")
2
for items in items1:
3
items.click()
4
Advertisement
Answer
JavaScript
1
4
1
items1 = driver.find_elements_by_xpath("//div[@class='teams']")
2
for items in items1[:9]:
3
items.click()
4