0

Is it possible to get Selenium to match multiple class names?
For example:

driver.find_elements_by_class_name('image' or 'image-large')

Thanks

JeffC
  • 22,180
  • 5
  • 32
  • 55
  • This should be useful: https://stackoverflow.com/questions/21713280/find-div-element-by-multiple-class-names – AMC Mar 03 '20 at 20:26

1 Answers1

3

In CSS you would do .image, .image-large to match elements that have either image class or image-large class.

And Selenium has a CSS selector method:

driver.find_elements_by_css_selector('.image, .image-large')
Martín De la Fuente
  • 6,155
  • 4
  • 27
  • 28