i want to get value from "value":"165796011" which in data-gbfilter-checkbox
I used
element= driver.find_element_by_css_selector('#widgetFilters > div:nth-child(1) > div.a-row.a-expander-container.a-expander-inline-container > span:nth-child(3)')
print(element.get_attribute('data-gbfilter-checkbox'))
but it give me all data which between data-gbfilter-checkbox bractes
HTML:
<span class="a-declarative" data-action="gbfilter-checkbox" data-gbfilter-checkbox="
{"attribute":"whitelist_categories","value":"165796011","rangeEnd":"","rangeStart":"","filterType":"checkboxes"}">
</span>
i solved it but now( i don't want to write 7 ,I want it with dynamic way)
great I converted the string to list and value number 7, but it's the static way I want to find numbers by the dynamic way ( i don't want to write 7 I want it with dynamic way)
pages= driver.find_element_by_css_selector('#widgetFilters > div:nth-child(1) > div.a-row.a-expander-container.a-expander-inline-container > div > span:nth-child(25)')
list= pages.get_attribute('data-gbfilter-checkbox').split('"') print(list[7])
pages= driver.find_element_by_css_selector('#widgetFilters > div:nth-child(1) > div.a-row.a-expander-container.a-expander-inline-container > div > span:nth-child(25)') list= pages.get_attribute('data-gbfilter-checkbox').split('"') print(list[7])