can I write Page Objects with Selenide?
Moreover, with Selenide your Page Objects get concise and readable comparing to the classical Selenium notation.
return page(GoogleResultsPage.class);
--
You received this message because you are subscribed to the Google Groups "selenide" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenide+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ok, what I'm getting at...try to describe below using 2 methods...1st one just copied from your tutorial, 2nd one is just an example (not sure of the syntax)
The point here is that search field attribute 'name' has value 'q' & it's used in 2 methods. If the value is changed, it'll need to be changed in both places; imagine if this field attribute is used in many more methods, we'll have to update all over. The example used is simple google search, while other applications have more fields on a page...like advanced search & registration forms.
Bottomline is that if Page Factory is used to define all this page objects at one place & then used, the change/maintainence can be done at one place & the change is effective all over.
1] public GoogleResultsPage search(String query) {
$(By.name("q")).setValue(query).pressEnter();
return page(GoogleResultsPage.class);
}
2] public GoogleResultsPage getSearchValue(String query) {
return $(By.name("q")).getValue(query);
}
Let me know if I'm not clear.
--
You received this message because you are subscribed to the Google Groups "selenide" group.
Thx for the detailed response. Actually the way I interpreted was that one can work w/o Page Objects, hence my question about repeating the "q" locator. Now I was not thinking of duplication on different pages as you described...'Search page' & 'Results page'. My concern was that if we do use locators in methods directly then even within the same page, if we have 2 different methods, say one for setting a search value (assuming we are searching using the Results page) & another for verifying that after a search the field retains the search value, then we have 2 methods using the 'q' locator. From your example I understand that we'll be having the 'q' locator in a class & using the reference of that definition...which is the conventional way of structuring in OOP. So, my question is, then how is this different from the regular OOP design? -- You received this message because you are subscribed to the Google Groups "selenide" group. To unsubscribe from this group and stop receiving emails from it, send an email to selenide+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
I was not saying it should be different from OOP; just that I thought you were saying this is different. From your answer I realize that you personally do not follow the classical selenium style page objects...instead repeat the locator within methods as needed AND update them when change occurs. I'm liking this idea...from your experience in implementing this, how easy is it to implement changes & what are the complications you faced for NOT having page objects defined? Hoping this discussion will help others to come to a conclusion in using Selenide as a wrapper for Selenium. Thx for your time. -- You received this message because you are subscribed to the Google Groups "selenide" group. To unsubscribe from this group and stop receiving emails from it, send an email to selenide+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Hi Andrei,I recently started using Selenide, and I need your help to know what import is required to use the page(GoogleResultsPage.class). For me eclipse doesn't seem to recognize the page() method to create a page object automatically.I'd appreciate any help, thank you!!Onkar
To view this discussion on the web visit https://groups.google.com/d/msgid/selenide/40c9a242-1f5a-46e9-8739-0127a71e99a9n%40googlegroups.com.