I am in search of a list of child div class tags. Inspecting elements in Chrome hasn't yielded the desired results with the Xpath I've been using.
There are 5 tabs displayed on the page and I need to gather all of them into a list for iteration using a For Each loop.
I need to find and collect all these tabs
<div class="jsx-1429490698 Tab Tab_active Tab_sports">sports</div>
<div class="jsx-1429490698 Tab Tab_casino">casino</div>
<div class="jsx-1429490698 Tab Tab_liveCasino">live & real</div>
<div class="jsx-1429490698 Tab Tab_esports">esports</div>
<div class="jsx-1429490698 Tab Tab_vegas">vegas</div>
The Xpath I'm using is
//div[@id='__next']//following-sibling::div[contains(@class, 'Tab')]
The locator declaration is as follows:
[FindsBy(How.Xpath, Using="//div[@id='__next']//following-sibling::div[contains(@class, 'Tab')]")]
private IList<IWebElement> PromotionBrandTabsListElement {get; set;}
When trying this Xpath locator in Chrome, it initially highlights
<div class="jsx-1350237217 Tabs__container">
and then it highlights
<div class="jsx-1429490698 Tab Tab_casino">casino</div>
I want it to highlight Sports, Casino, LiveCasino, Esports, and Vegas. I wish to have all these tab elements in a list.
The HTML structure looks like this:
<div id="__next">
<div class="jsx-2794910414 top">
<div class="jsx-133833352 Promotions__container">
<div class="jsx-1850983400 Title__container">
<div class="jsx-1850983400 Title__text--container">
<div class="jsx-1850983400 Title__text">Promotions</div>
</div>
</div>
<div class="jsx-1350237217 Tabs__container">
<div class="jsx-1429490698 Tab Tab_active Tab_sports">sports</div>
<div class="jsx-1429490698 Tab Tab_casino">casino</div>
<div class="jsx-1429490698 Tab Tab_liveCasino">live & real</div>
<div class="jsx-1429490698 Tab Tab_esports">esports</div>
<div class="jsx-1429490698 Tab Tab_vegas">vegas</div>
</div>
<div class="jsx-3650671054 jsx-3221847745 Promotion">
</div>
</div>
How can I specifically retrieve Sports, Casino, LiveCasino, Esports, and Vegas tabs?
Thank you