-2

I am on this page on Tokyo Olympic Website

I would like to get all the elements that has class name beginning with a specific string. For instance I want to get all elements that begin with 'col-sm-'.

html.r.find('.col-sm-6') gives me all elements that have class name col-sm-6. However I would like to get all elements starting with class name col-sm-. In documentation they have asked to refer CSS selector at this link. As per the information on that page either:

r.html.find('[class~=col-sm-]') or r.html.find('[class=col-sm-]') should do the job but they return an empty list.

Sam
  • 21
  • 7

1 Answers1

0

Maybe that would work

*[class^='col-sm-']

Here is an image from chropath extension

As you can see, other classes that starts with col-sm- are returned as well

kmcakmak
  • 139
  • 6