Create a method in TestContainer which returns the message text and use that instead of find_element and then .text.