find_element_by_class_name for multiple classes [duplicate]
The answer is No, You can't use driver.find_element_by_class_name ()
or driver.find_elements_by_class_name ()
with multiple class names. It accepts only single class name.
However, you can use find_elements_by_xpath
or find_element_by_css_selector
method to achieve finding element with multiple class names.
for example below code will find element on google website using two different class names.
url= "http://google.com"
driver = webdriver.Chrome()
driver.get(url)
driver.find_elements_by_xpath("//*[@class='sfibbbc' or @class='jsb']")
# Following line will result in error
driver.find_elements_by_class_name("sfibbbc jsb")