Selenium python find_element_by_class_name() stopped working from v 2.2 to 2.21 -- cannot use 'Compound Class Name' Selenium python find_element_by_class_name() stopped working from v 2.2 to 2.21 -- cannot use 'Compound Class Name' selenium selenium

Selenium python find_element_by_class_name() stopped working from v 2.2 to 2.21 -- cannot use 'Compound Class Name'


The problem about WebDriver is that it still evolves. A lot. I personally don't know about a version that supported searching by many classes in one command, so it must have been a fairly old one :).

Searching by a CSS selector should work, however:

find_element_by_css_selector(".grid-cell-inner.grid-col-name");

I don't recommend using XPath for this particular thing, because these two following expressions are a different thing:

//*[class='grid-cell-inner grid-col-name']

//*[class='grid-col-name grid-cell-inner']


You need to use a CssSelector in the format ".nameA.nameB.nameC" you can have as many as you'd like, just add the "."

Alternatively you can match the whole attribute (you can also do this with xpath): "[class='exact class name here']"XPath - "//[@class='exact class name here']"

There are ways to do starts with or ends with or contains too (in both CSS and xpath) which helps if the classes are generated dynamically.


Selenium hasn't supported compound class names for a very long time I thought.

Needless to say, try via XPath or CSS selector or by the class name of "grid-cell-inner" then filtering to see what elements have the class of "grid-cell-inner grid-col-name".