Is it possible to do something like this? I want to know the number of elements with the class property set to 'gsc-cursor-page'.
pages_nav = driver.find_element_by_css_selector('.gsc-cursor')
pages = driver.find_element_by_css_selector('.gsc-cursor-page')
for pages in pages_nav:
print("len(pages)")
As shown below are (.gsc-cursor-page) inside (.gsc-cursor) So how can I obtain the number of elements with classname 'gsc-cursor-page'.

To print the number of elements with
classnameproperty set to gsc-cursor-page you can use either of the following locator strategies:Using CLASS_NAME:
Using CSS_SELECTOR:
Using XPATH:
Update
The output of
15,13and13is perfect as the xpath and the css_selector looks for the elements only with classnamegsc-cursor-pagei.e. perfect match and there can be some more elements outside the scope of the snapshot you provided and some more elements which also contains the classnamegsc-cursor-page.Solution
Your effective line of code will be:
Using CSS_SELECTOR:
Using XPATH: