-
Notifications
You must be signed in to change notification settings - Fork 220
简单的DSL
easonhan edited this page May 24, 2013
·
1 revision
PageObject
module为你的页面对象(page object)自动添加了一些方法。这些方法是类似的且有章可循的。我们看一下这些方法及其输出。
这样调用text_field
方法
text_field(:first_name, :id => 'fname')
会自动的生成下面的四个方法
first_name # 返回这个text field的value
first_name= # 设置text field的value
first_name_element # 返回这个text field元素
first_name? # 检查该元素是否存在
有一种例外是当你调用page_url
方法时
page_url 'http://www.google.com'
会自动生成goto
方法
goto # navigate to the url that was specified in the page_url
你看查看Accessors
module的文档以便了解所有自动生成的方法。