New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accessors for multiple elements #144
Comments
I haven't verified this, but can't you already accomplish the same thing with this? def history_notes
div_elements(:class=> 'history').map(&:text)
end |
It works, but it's not much different from watir: def history_notes
browser.divs(:class => 'history').map(&:text)
end and I'd want to be able to define elements in a single place (section of page-object accessors calls) to keep page classes well-organized. |
The form that @wjpowell showed works just fine. I really do not see the need to add another set of methods that generate other methods when it is very simple to get what you want with the existing api. |
I know that it works. However, one of the advantages of page-object is that it makes page classes very structured because literally all the elements are defined using class methods and are in the beginning of class. Without accessors to multiple elements, you have to define elements in instance methods. That's IMO and may be irrelevant, so just close the issue if you think it doesn't worth :) |
I've added this to the gem. It will go out with the release I have planned for later today. |
Thanks! |
If i have 3 divs with same class name. How do i access the first div's text? |
@swaroop-tata You can get particular div with div(:my_div, class: 'common-class', index: 0) |
Hi!
I've been thinking about the ways to do smth like this
Is multiple elements accessors are possible or planned?
The text was updated successfully, but these errors were encountered: