Tag Info

Hot answers tagged

11

I find the Page Object pattern very useful, and use a modified PageFactory (parameterized for custom timeouts). I also use WidgetObjects (basically, PageObjects with a parent reference via constructor) to represent common themes across pages. I don't think URL association is necessary on all pages, so I keep it out of my base class. URL params? I keep ...


4

Advantages: Clear separation between test code and navigation code in code base. Easy to comprehend test, for example - Homepage.testLogin(username, password); is more succinct than selenium.type(username); selenium.type(password); selenium.click(submit); selenium.waitForpageToLoad(waitPeriod); Ease of maintenance, when UI changes you need to ...


3

Read this ( scroll down to the page objects section though the whole page us good ) and this for some background Or from this page Taking it back to basics, essentially there are three functions I see a page object pattern provides: Ability to easily instantiate pages in a consistent manner Ability to concisely describe elements on a page, ...


3

There are times when using the Page Object Pattern makes a lot of sense and times where it doesn't make as much sense. If you have a web application where it is basically one single dynamic page then it makes less sense, however you can still use "page" objects that are really more like "section" objects for common pieces, for example if you have a Left ...


3

After spending some more time with WebDriverWait, I came out with something nicer: Client code: /** Page Object. */ public class Page { private WebElement mySelect; public Page setMySelect(String optionText) { String optXpath = String.format("./option[text()='%s']", optionText); mySelect.click(); ...


3

My answers below are based on the framework that we've built, which uses a state machine to traverse the application we're testing. The URL (or, rather, a compiled regex representing the URL) is indeed a property of the individual page objects in my test suite. They all descend from a base page object very similar to terryp's (though we've converted to ...


2

I use Python and Selenium 1 and find page objects very useful. Mostly don't care about the URL. I check the page contents to make sure I'm where I expect. Most of the fields in my page objects relate to form fields on the page. I also have object fields that can read bits of static text based on the DOM. I have a base class with a variety of utility ...


2

I do not know which ''this'' you are referring to when you ask, "Am I getting all this wrong?" According to the Wiki page, the isLoaded method should use JUnit assertions to check whether the page is actually loaded. JUnit assertions throw Errors, not exceptions, to signal that something went wrong. LoadableComponent could have refactored isLoaded into ...


1

Given that you can't return a page object, you might have each test stuff its last page object into a member variable, so that the next test can access it. This is ugly, of course, because it increases the dependence between tests, and does so in a not-exactly-obvious way. But the results might give ideas about what to do next. And if it's too ugly you can ...


1

I'm using the inherited based design and it worked great until the application I'm testing was also made available in another more limited customer facing UI. So now i have 2 applications which consist of the same components surrounded by different menu's. That's a situation where the inherited design breaks. An aggregation based design combined with some ...


1

Is a page URL a property of the Page Object ? What if a number of different URLs lead to the same page ? Also, what if the URL is used to pass some parameters, do you if at all deal with that ? Most of my pages don't know (or care) about the URLs that lead to them. When I have pages that I want to jump to directly (rather than navigating to by ...


1

I write my Selenium tests in Clojure, a Lisp that runs on the JVM. While it is possible to define objects in Clojure, it makes more sense to organize Lisp code using functions rather than objects, so my tests are all written as functions with the occasional closure. (I mention Clojure to put into context why I don't use page objects, not as an endorsement ...



Only top voted, non community-wiki answers of a minimum length are eligible