Tag Info

Hot answers tagged

5

My first advice is to not write automated tests for pages that change frequently. You may be better off testing those pages manually. If you insist on automation, think about which aspects of the pages do not change, and write classes to model those aspects. For example, if forms always consist of text fields and a submit button, you can write a class to ...


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

There are three main advantages to putting your functions into PageObjects rather than just having a bunch of static functions: Context. LoginPage.clickNext() vs ItemDetails.clickNext() immediately tells you what page you're on when looking at the test, even if they're identical methods inherited from a parent class. The PageObjectFactory can ...


1

Though there are many advantages of Page Project Model, some of them are : Simple and clear page classes with sensible method names. You can actually give the customize names to you methods. Like above so that you need not to keep anything in mind. Just looking into the method name gives you all idea about the capabilities of the method. Makes tests more ...



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