I am trying to get the values of available license inside the table using selenium in python3. I am able to get the values using XPATH, and iterate through each rows. But XPATH is not ideal, since the table might change and include an additional column, thus will fail to get the correct value.
The values I want, is 98,50,etc...
<div class="slick-cell l6 r6 licensesUsedValueGrid">
<div class="slick-cell odd" style="padding: 0px;width:100%;height: 44px;">
<div style="padding: 15% 4px 0px 0%;float: right;">98</div>
</div>
</div>
<div class="slick-cell l6 r6 licensesUsedValueGrid">
<div class="slick-cell odd" style="padding: 0px;width:100%;height: 44px;">
<div style="padding: 15% 4px 0px 0%;float: right;">50</div>
</div>
</div>
This is using XPATH, and it worked:
for i in range(1, rows, 2):
pak_id = browser.find_element_by_xpath(f'//*[@id="scrollBarDiv"]/div/div[{i}]/div[3]/div/div/div[1]').text
used_license = browser.find_element_by_xpath(f'//*[@id="scrollBarDiv"]/div/div[{i}]/div[7]/div/div').text
available_license = browser.find_element_by_xpath(f'//*[@id="scrollBarDiv"]/div/div[{i}]/div[8]/div/div').text
I would like to use class name or some other means so that even if they add another column to the table, i will be able to capture the right value of 'license used' and 'license available'
Picture of how it looks like on chrome: