Holmium Classes

Page Objects & Friends

class holmium.core.Page(driver, url=None, iframe=None)

Base class for all page objects to extend from. void Instance methods implemented by subclasses are provisioned with fluent wrappers to facilitate with writing code such as:

class Google(Page):
    def enter_query(self):
        ....

    def submit_search(self):
        ....

    def get_results(self):
        ....

assert len(Google().enter_query("page objects").submit_search().get_results()) > 0
class holmium.core.Section(locator_type, query_string, iframe=None)

Base class to encapsulate reusable page sections:

class MySection(Section):
    things = Elements( .... )

class MyPage(Page):
    section_1 =  MySection(Locators.CLASS_NAME, "section")
    section_2 =  MySection(Locators.ID, "unique_section")
class holmium.core.Sections(locator_type, query_string, iframe=None)

Base class for an Iterable view of a collection of holmium.core.Section objects.

class holmium.core.Element(locator_type, query_string, base_element=None, timeout=1, value=<function <lambda> at 0x40e1b18>)

Utility class to get a selenium.webdriver.remote.webelement.WebElement by querying via one of holmium.core.Locators

class holmium.core.Elements(locator_type, query_string, base_element=None, timeout=1, value=<function <lambda> at 0x40e1b18>)

Utility class to get a collection of selenium.webdriver.remote.webelement.WebElement objects by querying via one of holmium.core.Locators

class holmium.core.ElementMap(locator_type, query_string=None, base_element=None, timeout=1, key=<function <lambda> at 0x40e1e60>, value=<function <lambda> at 0x40e1ed8>)

Used to create dynamic dictionaries based on an element locator specified by one of holmium.core.Locators.

The wrapped dictionary is an collections.OrderedDict instance.

Parameters:
  • key (lambda) – transform function for mapping a key to a WebElement in the collection
  • value (lambda) – transform function for the value when accessed via the key.
class holmium.core.Locators

proxy class to access locator types

CLASS_NAME = 'class name'
CSS_SELECTOR = 'css selector'
ID = 'id'
NAME = 'name'
TAG_NAME = 'tag name'
XPATH = 'xpath'
classmethod is_valid(by)

Deprecated Classes

Earlier versions of holmium.core used rather verbose names for Page objects and elements. As of version 0.2 the classes have been renamed but the older names have been retained as aliases to the new classes for backward compatibility (an annoying warning will however, be emitted everytime the old names are used to hopefully convince test authors to update their test code :D ).

class holmium.core.PageObject(driver, url=None, iframe=None)

Deprecated alias for Page

class holmium.core.PageElement(locator_type, query_string, base_element=None, timeout=1, value=<function <lambda> at 0x40e1b18>)

Deprecated alias for Element

class holmium.core.PageElements(locator_type, query_string, base_element=None, timeout=1, value=<function <lambda> at 0x40e1b18>)

Deprecated alias for Elements

class holmium.core.PageElementMap(locator_type, query_string=None, base_element=None, timeout=1, key=<function <lambda> at 0x40e1e60>, value=<function <lambda> at 0x40e1ed8>)

Deprecated alias for ElementMap

class holmium.core.HolmiumTestCase(methodName='runTest')

Deprecated alias for TestCase

Utilities

class holmium.core.TestCase(methodName='runTest')
holmium.core.repeat(loop)

Table Of Contents

This Page