As per the documentation of selenium.webdriver.common.by
implementation:
class selenium.webdriver.common.by.By
Set of supported locator strategies.
CLASS_NAME = 'class name'
So,
-
Using
find_element_by_class_name()
you won’t be able to pass multiple class names.
Passing multiple classes you will face the error as:Message: invalid selector: Compound class names not permitted
-
Additionally, as you want to return an array of the chats, so instead of
find_element*
you need to usefind_elements*
Solution
As an alternative you can use either of :the following Locator Strategies:
-
CSS_SELECTOR
:recived_msg = driver.find_elements_by_css_selector(".XELVh.selectable-text.invisible-space.copyable-text")
-
XPATH
:recived_msg = driver.find_elements_by_xpath("//*[@class="XELVh selectable-text invisible-space copyable-text"]")