I am trying to use selenium with python to go through different tabs (buttons?) on a carousel so that I can collect data from each of them, but the problem is the webelement that I need to use is the same name for each tab (button).
I can find the following html code using .child and getting a list but I don't know how to do this with Selenium.
[<div class="rj-carousel-item" data-uat="carousel-item-sport"><span class="icon i-o-sport-2 i-32"></span><div class="rj-carousel-item__details"><div class="rj-carousel-item__sportName" data-uat="carousel-item-sportName">Basketball</div><div class="rj-carousel-item__eventsCount" data-uat="carousel-item-eventsCount">14</div></div></div>,
<div class="rj-carousel-item" data-uat="carousel-item-sport"><span class="icon i-o-sport-8 i-32"></span><div class="rj-carousel-item__details"><div class="rj-carousel-item__sportName" data-uat="carousel-item-sportName">Ice Hockey</div><div class="rj-carousel-item__eventsCount" data-uat="carousel-item-eventsCount">10</div></div></div>,
<div class="rj-carousel-item" data-uat="carousel-item-sport"><span class="icon i-o-sport-1 i-32"></span><div class="rj-carousel-item__details"><div class="rj-carousel-item__sportName" data-uat="carousel-item-sportName">Soccer</div><div class="rj-carousel-item__eventsCount" data-uat="carousel-item-eventsCount">11</div></div></div>,
<div class="rj-carousel-item" data-uat="carousel-item-sport"><span class="icon i-o-sport-6 i-32"></span><div class="rj-carousel-item__details"><div class="rj-carousel-item__sportName" data-uat="carousel-item-sportName">Tennis</div><div class="rj-carousel-item__eventsCount" data-uat="carousel-item-eventsCount">14</div></div></div>
Now If I use
new_tab = driver.find_element_by_class_name('rj-carousel-item')
new_tab.click()
Then I can access the first tab, but I don't know how to get to the rest. Again, I'm assuming it has to do with making a list of these but I can't seem to figure out how