我想在<;中存储一条消息;p>;带有ruby绑定的selenium web驱动程序中的标记

我想在<;中存储一条消息;p>;带有ruby绑定的selenium web驱动程序中的标记,ruby,selenium-webdriver,Ruby,Selenium Webdriver,我想存储“您输入的id在我们的数据库中不存在。请注意,id区分大小写和空格。”在变量中 <p class="message fail"> The id you entered does not exist in our database. Please note, ids are case and space sensitive. </p> 您输入的id在我们的数据库中不存在。请注意,ID区分大小写和空间 试试: .text方法将为您提供元素的文本 your_varia

我想存储
“您输入的id在我们的数据库中不存在。请注意,id区分大小写和空格。”
在变量中

<p class="message fail"> The id you entered does not exist in our database. Please note, ids are case and space sensitive. </p>
您输入的id在我们的数据库中不存在。请注意,ID区分大小写和空间

试试:

.text
方法将为您提供元素的文本

your_variable = driver.find_element(:class, 'message fail').text