Selenium Compound class names not permitted

Leon’s comment leads to the correct information that compound class names are no longer supported. What you could do instead is try using css selectors. In your case, the following line of code should help you get the element you want :

el3 = driver.find_element_by_css_selector(".action-btn.cancel.alert-display")

It finds the element with all three classes (action-btn, cancel and alert-display) in the class attribute. Do note that the order of the classes does not matter here and any of the classes may appear anywhere in the class attribute. As long as the element has all three classes, it will be selected.
If you want the order of the classes to be fixed, you can use the following xpath :

el3 = driver.find_element_by_xpath("//*[@class="action-btn cancel alert-display"]") 

Leave a Comment