开发者

How to retrieve <textarea> value in Ruby Cucumber unit testing tool

开发者 https://www.devze.com 2023-04-05 06:43 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消