Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I'd like to know if there is a framework in Python which supports a clean way to define the Page Object Elements on a Page Object.

The site_prism gem does it like so:

class Home < SitePrism::Page
  set_url "/index.htm"
  set_url_matcher /google.com\/?/
  element :search_field, "input[name='q']"
  element :search_button, "button[name='btnK']"
  elements :footer_links, "#footer a"
  section :menu, MenuSection, "#gbx3"
end

class MenuSection < SitePrism::Section
  element :search, "a.search"
  element :images, "a.image-search"
  element :maps, "a.map-search"
end

Does anyone know of a Python package which gives me something similar to site_prism or page_object?

share|improve this question
    
Our organization has done so for Python. It uses Robot Framework's Selenium2Library under the hood, but is usable independently of Robot tests. I am trying to release it open-source. –  Aaron Aug 1 at 1:26
    
You ended up writing your own? –  sheeptest Aug 1 at 1:31
    
Yes, I didn't find much out there that suited our needs. I think it's a pretty good package and like I said we are trying to get our organization to allow us to release it open-source. It even integrates with Sauce. –  Aaron Aug 1 at 1:39
1  
I also did quite a lot of research and ended up writing our own. There is not much to it, doing it in Python as compared to Java. You have simpler structure, only what you need. But I am very interested what other people use. Remember, UnitTest was created in Smalltalk not as library module or framework, but just a design pattern. PageObject is design pattern, implement it according to your specific needs. –  Peter Masiar Aug 1 at 13:26
    
I'm mostly interested in the nice syntax you can get out of it. I found bok-choy and I might look into mimicking the usage when I write my own. –  sheeptest Aug 1 at 13:43

3 Answers 3

You might try WTFramework It seems like a decent starting place for python test infrastructure. I didn't end up using it because my tests ended up using more php and javascript. There are examples of using the page object design pattern.

share|improve this answer
    
That looks reasonable. A lot of it is specific for browser testing. I might learn from their examples and apply them to my mobile-specific POP. Thank you!! –  sheeptest Sep 21 at 2:31
up vote 0 down vote accepted

I ended up writing my own Page Object framework which had some mobile-specific GUI automation features like locators by platform and other nice things so that my tests are platform agnostic.

I'm considering open-sourcing it. Will post here with any updates on that, or if I find another Page Object framework in Python.

share|improve this answer

I've had great success with holmium.core http://holmiumcore.readthedocs.org/en/latest/

share|improve this answer
    
Welcome to SQA, B.Berndsen. I notice that you have two posts so far, and that they are both promoting holmium core. This isn't entirely against our rules, if you're affiliated with holmium, you will need to disclose this in your post. (Each post that mentions it.) Also, generally a post that is just a link is discouraged. It is sometimes appropriate, but rarely so. A post like this can usually be expanded with examples and supporting information. –  corsiKa Aug 1 at 2:48
    
Holmium looks pretty good. I think we looked at it, and I don't remember why we didn't choose it. Our solution doesn't expose the driver. That's taken care of in the base Page class. We base our library off of Selenium2Library, which is a really nice Robot interface to Selenium2. This means that you leverage that library whether you are writing Robot tests, unittest TestCases, Cucumber tests etc. It also adds a real page object pattern to Robot, which lacks that ability natively. –  Aaron Aug 1 at 3:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.