I want to get only the text \"Invitation sent to xxxxx\", I do not want to get what\'s inside the
In fact Selenium's getText() method retrieves all the text in sub elements too, so the approach, recommended by Murthi is the most applicable, as far as I know. Try this approach:
String newLine = System.getProperty("line.separator");
String pessoapopu = driver.findElement(By.className("artdeco-toast-message"))
.getText().replaceAll(newLine, "");
Or try/ask for more convenient HTML code.