I'm currently learning Selenium and was given an test case to create, using store.steampowered.com/search/?filter=topsellers as an test site. I need to get number that is near checkbox "Action", as highlighted on a screenshot.
This is a part of a page code that describes this specific checkbox:
<div class="tab_filter_control_row " data-param="tags" data-value="19" data-loc="Action" data-clientside="0">
<span class="tab_filter_control tab_filter_control_include " data-param="tags" data-value="19" data-loc="Action" data-clientside="0" data-gpfocus="item">
<span>
<span class="tab_filter_control_checkbox"></span>
<span class="tab_filter_control_label">Action</span>
<span class="tab_filter_control_count" style="">30</span>
</span>
</span>
<span class="tab_filter_control_not " data-param="untags" data-value="19" data-icon="https://store.akamai.steamstatic.com/public/images/search_crouton_not.svg" data-loc="Action" data-clientside="0" data-tooltip-text="Exclude results with this tag" data-gpfocus="item"><img src="https://store.akamai.steamstatic.com/public/images/search_checkbox_not.svg" width="16px" height="16px"></span>
</div>
To do that I wrote this XPath locator: //span[@data-value='19']//*[@class='tab_filter_control_count']. But when I do something like this:
string str = driver.FindElement(By.XPath("//span[@data-value='19']//*[@class='tab_filter_control_count']"));
I for some reason will get "1 635", not "30". I tried to get text by using different XPath, //div[@data-collapse-name='tags']//*[@data-value='19'], but result will be "Action 1 635".
Maybe somebody will explain how 30 turns into 1 635 and how I can get the right number.