Tag Info

Hot answers tagged

3

In my opinion, yes, it does. However there isn't really a single way to implement this model that just works. You have to really think about the structure of your website in terms of it's pages, and figure out how you can represent that structure in your code. For one company I worked for, I used the page object model against pages that were very simple ...


3

I had similar question few years back. At that point I had only seen page object based implementation. In my current company we have a single framework that manages mobile, web, web services. A nice presentation of page object challenges is available in http://www.slideshare.net/abagmar/perils-of-pageobject-pattern. There is also a youtube session on the ...


3

PageObjects The code of automated test cases should be easy to understand and not too complex. If a test fails, we want to know why and this as soon as possible. To allow this exists PageObjects. PageObjects are classes that contains WebElements and every actions associated with those. A PageObject looks like this: class HomePage { WebDriver driver; ...


2

Given that there is disagreement, the answers this question attracts will probably gravitate toward sometimes rather than yes/no. My opinion is that page objects should have assertions in their constructors, so that my code doesn't offer page methods for a page I never reached. In a made up example, I don't want to return an account page object when I've ...


2

Your screenshot function is creating a new WebDriver instance each time and then taking a screenshot of the default blank page in firefox. You could try passing in your test's WebDriver instance so you get a picture from your test: static public void screenShotOnError(WebDriver driver) { long epoch = System.currentTimeMillis(); String ssTimestamp = ...


1

Your setup method should be setUp for unittest. I'm not sure why they decided to name it that way, but that's just how it is. Since setup is not a keyword it's not getting called, thereby making self.driver throw an AttributeError.


1

Sometimes it so happens that the wait commands do not work. Instead of the wait command of selenium try using Thread.sleep(); command of java. This command will pause execution of the script for the given time...


1

I like the method that is used by the conversion from Selenium IDE to Selenium C# personally, which is as follows: for (int second = 0;; second++) { if (second >= 60) Assert.Fail("timeout"); try { if (IsElementPresent(By.Id("blargh")"))) break; } catch (Exception) ...


1

Yes. It's documented in official documentation. Also you can find an example here to understand better / start with.


1

Did you run PageFactory.initElements? The PageFactory magic won't actually parse the annotations until you do so. I usually put into the constructor a line like: PageFactory.initElements(driver, this); So that it runs when I construct the page.



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