How to access page object element in step definitions without created a method for it?

54 views
Skip to first unread message

gkoltsov

unread,
May 19, 2013, 8:40:02 AM5/19/13
to cucumber-...@googlegroups.com
Greetings,
Is there a way to access page object element in step definitions without created a method for it?
Something like this:
on_page(Homepage).some_button_element.visible?
Right now I have a list of elements that I should check if they are visible on the page or not.
In order to check if all these elements are present and visible on the page there are several ways to do it (as I see for now):
1. Create method per element or one method per all elements and check if they are visible or not inside the method.
2. Create step definitions passing the name of elements inside these steps and call appropriate method that checks if passed in element is visible or not.
But maybe there is a way to make page-object elements as attr_accessors? I tried "attr_accessor button(:some_button, :id => 'button')" but it did not work.
What is the right way of implementation?

Thanks in advance,
George

Željko Filipin

unread,
May 25, 2013, 12:34:35 PM5/25/13
to gkoltsov, cucumber-...@googlegroups.com
On Sun, May 19, 2013 at 2:40 PM, gkoltsov <koltsov...@gmail.com> wrote:
Is there a way to access page object element in step definitions without created a method for it?

I do not understand what are you trying to do.

Željko
--
https://leanpub.com/watirbook
Reply all
Reply to author
Forward
0 new messages