Tag Info

Hot answers tagged

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; ...


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

We have had a very hard time automating the Google Maps API. Test case: Surf to Google maps: https://www.google.nl/maps Find an area with known location Click the known location (without the use of mouse-coordinates, should also work when zooming, etc...) Verify the location box with details opens Retrieve the phone number This is very hard, because ...


2

@FindBy(css="a[dta-qid='inventory']") I've used that kind of locators in my last project and it's worked like charm. I hope this is that You want :)


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

"Test automation" means more than just automating user interfaces that run in a web browser. Someone with good programming skills should be able to find many other ways to use software to test software. Here are are couple of examples: Write API-level integration tests. If developers test, they probably focus on unit tests. There is a middle ground ...


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

A CMS can be challenging. You have content moving, user permissions, generated IDs, etc. Try out WordPress. I snapped out of the automation boredom once I hired someone to take it over and I took on security testing and process improvement. Start with OWASP for security.


1

I think Single Page Applications type which last time gains more and more popularity can be hard to automate, because this type of pages are dynamically loaded. Every action on page can load new div from server without reloading whole page, just for example simple paste table to div. Webdriver cache webelements on page load, and dynamical loading of html ...


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

No, no and no. :) Do not initialize all your page objects at the start, what if your application keeps growing and growing. We already have hundreds of page objects, this could potential slow down all your tests in the suite. We always use the following way to access a Page: "Methods return other PageObjects" Example from Ubuntu acceptance testing: An ...


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