我想在selenium web-driver中使用ruby bindings </p>存储一个在<p>标签中的消息

时间:2012-09-25 13:44:15

标签: ruby selenium-webdriver

我想将"The id you entered does not exist in our database. Please note, ids are case and space sensitive."存储在变量中。

<p class="message fail"> The id you entered does not exist in our database. Please note, ids are case and space sensitive. </p>

1 个答案:

答案 0 :(得分:2)

尝试:

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

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