How to retrieve <textarea> value in Ruby Cucumber unit testing tool
I am using the Cucumber unit test tool, and am trying to retrieve the value of a textarea
, however I can't get it to work.
This is my code...
page.find(:xpath, "//div[@id='process']/table/tbody/tr/td/div/textarea").value
This is the error I'm getting...
Error: undefined method `value' for nil:NilClass (NoMethodError)
This URL listed below confirms that value
is the correct met开发者_如何学编程hod to retrieve the value:
http://www.w3schools.com/jsref/dom_obj_textarea.asp
Could someone please help me fix this problem.
The nil
error indicates that you're not getting the textarea -- find is returning nil
. Try a simpler xpath query, or referencing the textarea by name or id.
精彩评论