예제 #1
0
 class SimplePage(Page):
     id_el = Element(Locators.ID,
                     "simple_id",
                     filter_by=lambda el: el.text == "simple_id")
     id_el_none = Element(Locators.ID,
                          "simple_id",
                          filter_by=lambda el: el.text == "changed")
예제 #2
0
 class SimplePage(Page):
     id_el = Element(Locators.ID, "simple_id")
     class_el = Element(Locators.CLASS_NAME, "simple_class")
     selector_el = Element(Locators.CSS_SELECTOR, "div.simple_class")
     xpath_el = Element(
         Locators.XPATH, "//div[h3/text()='Simple XPATH']"
     )
예제 #3
0
class LoginPage(BasePage):
    email = Element(Locators.NAME, "email", facet=True)
    password = Element(Locators.NAME, "password", facet=True)
    submit = Element(Locators.ID, "login-submit", facet=True)

    def login(self, email, password):
        self.email.send_keys(email)
        self.password.send_keys(password)
        self.submit.click()
예제 #4
0
class WikiPedia(Page):
    languages = ElementMap( Locators.CLASS_NAME, "central-featured-lang"
                                    , key = lambda el:el.get_attribute("lang")
                                    , value = lambda el: el.find_element_by_tag_name("a"))
    search_box = Element( Locators.CSS_SELECTOR, "input#searchInput" )
    article_title = Element( Locators.CSS_SELECTOR, "h1#firstHeading span[dir=auto]" )
    search_results = ElementMap( Locators.CSS_SELECTOR, "div.mw-search-result-heading>a")
    def search(self,  query ):
        self.search_box.clear()
        self.search_box.send_keys( query )
        self.search_box.submit()
예제 #5
0
        class FluentPage(Page):
            thing = Element(Locators.NAME, "thing")

            def click_thing(self):
                self.thing.click()

            def get_thing(self):
                return self.thing
예제 #6
0
class SauceDemoTest(Page):
    """
    This class is use for defining all the page source objects.
    Args : Page
    """
    user_name_input = Element(Locators.ID,
                              form_pageobjects.USER_NAME,
                              only_if=conditions.VISIBLE(),
                              timeout=60)
    password_input = Element(Locators.ID,
                             form_pageobjects.PASSWORD,
                             only_if=conditions.VISIBLE(),
                             timeout=60)
    login_button = Element(Locators.ID,
                           form_pageobjects.LOGIN_BUTTON,
                           only_if=conditions.VISIBLE(),
                           timeout=60)
    product_label = Element(Locators.CSS_SELECTOR,
                            form_pageobjects.PRODUCT_LABEL,
                            only_if=conditions.VISIBLE(),
                            timeout=60)
    product_list = Elements(Locators.CSS_SELECTOR,
                            form_pageobjects.PRODUCTS_LIST,
                            only_if=lambda el: el[0].is_displayed(),
                            timeout=60)
    product_info_label = Element(Locators.CSS_SELECTOR,
                                 form_pageobjects.PRODUCT_INFO_LABEL,
                                 only_if=conditions.VISIBLE(),
                                 timeout=60)
    product_cart_list = Elements(Locators.CSS_SELECTOR,
                                 form_pageobjects.PRODUCT_CART_LIST,
                                 only_if=lambda el: el[0].is_displayed(),
                                 timeout=60)
    cart = Element(Locators.CSS_SELECTOR,
                   form_pageobjects.CART,
                   only_if=conditions.VISIBLE(),
                   timeout=60)
    cart_items = Elements(Locators.CSS_SELECTOR,
                          form_pageobjects.CART_ITEMS,
                          only_if=lambda el: el[0].is_displayed(),
                          timeout=60)
    remote_items = Elements(Locators.CSS_SELECTOR,
                            form_pageobjects.REMOVE_ITEMS,
                            only_if=lambda el: el[0].is_displayed(),
                            timeout=60)
    menu_button = Element(Locators.CSS_SELECTOR,
                          form_pageobjects.MENU,
                          only_if=conditions.VISIBLE(),
                          timeout=60)
    logout_user = Element(Locators.ID,
                          form_pageobjects.LOGOUT,
                          only_if=conditions.VISIBLE(),
                          timeout=60)
예제 #7
0
파일: steps.py 프로젝트: zehua/holmium.core
class TestPage(Page):
    el = Element(Locators.NAME, "el")
    els = Elements(Locators.NAME, "els")
    elmap = ElementMap(Locators.NAME, "elmap")
    sections = TestSections(Locators.NAME, "sections")
    section  = TestSection(Locators.NAME, "section")
    def do_stuff(self, a, b):
        return a+b

    def do_stuff_no_args(self):
        return True

    def do_stuff_var_args(self, *args, **kwargs):
        return args, kwargs
예제 #8
0
class GoogleMain(Page):
    search_box = Element(Locators.NAME, "q", timeout=2)
    search_results = Elements(
        Locators.CSS_SELECTOR, "div.rc", timeout=2,
        value=lambda el: {
            "link": el.find_element_by_css_selector(
                "div.r>a"
            ).get_attribute("href"),
            "title": el.find_element_by_css_selector("div.r>a>h3").text
        }
    )

    def search(self, query):
        self.search_box.clear()
        self.search_box.send_keys(query)
        self.search_box.submit()
예제 #9
0
 class SimplePage(Page):
     el_list_default = Elements(Locators.CLASS_NAME, "simple_class")
     el_list_valuemapper = Elements(
         Locators.CLASS_NAME,
         "simple_class",
         value=lambda el: el.find_element_by_tag_name("a").text)
     el_list_valuemapper_complex = Elements(
         Locators.CLASS_NAME,
         "simple_class",
         value=lambda el: {
             "link": el.find_element_by_tag_name("a").get_attribute(
                 "href"),
             "text": el.find_element_by_tag_name("a").text
         })
     first_el = Element(Locators.TAG_NAME,
                        "a",
                        base_element=el_list_default[0])
예제 #10
0
 class SimplePage(Page):
     id_el = Element(Locators.ID, "simple_id")
     id_el_changed = Element(Locators.ID, "simple_id", timeout=10,
                             only_if=lambda el: el.text == "changed")
예제 #11
0
 class SimplePage(Page):
     elements = [
         Element(Locators.ID, "simple_id"),
         Element(Locators.CLASS_NAME, "simple_class")
     ]
예제 #12
0
 class SimplePage(Page):
     elements = {
         "id": Element(Locators.ID, "simple_id"),
         "class": Element(Locators.CLASS_NAME, "simple_class")
     }
예제 #13
0
 class P(Page):
     id_el = Element(Locators.ID,
                     "simple_id",
                     only_if=condition,
                     timeout=5)
예제 #14
0
class BasicPageIframe(Page):
    element = Element(Locators.CLASS_NAME, "frame_el")
    elements = Elements(Locators.CLASS_NAME, "frame_el")
    frame_1 = BasicSectionIframe(Locators.CLASS_NAME, "section", "frame_1")
    frame_2 = BasicSectionIframe(Locators.CLASS_NAME, "section", "frame_2")
예제 #15
0
class BasicSectionIframe(Section):
    element = Element(Locators.CLASS_NAME, "frame_el")
예제 #16
0
 class P(Page):
     el = Element(Locators.CLASS_NAME, "null")
예제 #17
0
class TestSections(Sections):
    el = Element(Locators.NAME, "el")
예제 #18
0
class JumboTron(Section):
    callout = Element(Locators.TAG_NAME, "h1")
    link = Element(Locators.CLASS_NAME, "btn")
예제 #19
0
class BadNavSectionStrictDebug(Section):
    links = Elements(Locators.CSS_SELECTOR, "ul>li")
    junk = Element(Locators.CLASS_NAME, "junk")
예제 #20
0
class TestSection(Section):
    el = Element(Locators.NAME, "el")
    els = Elements(Locators.NAME, "els")
    elmap = ElementMap(Locators.NAME, "elmap")
예제 #21
0
class MainPageWithCallable(BasePage):
    references = ElementMap ( Locators.CLASS_NAME, "reference-link")
    reference_content = Element(Locators.ID, "reference-content")
    selenium = Element(Locators.LINK_TEXT, "Selenium", timeout=5)
예제 #22
0
 class P(Page):
     e = Element(Locators.CLASS_NAME, "el")
     es = Elements(Locators.CLASS_NAME, "el")
     em = ElementMap(Locators.CLASS_NAME, "el")
예제 #23
0
class MainPageBadElement(BasePage):
    bad_element = Element(Locators.NAME, "bad_element", facet=True)
예제 #24
0
 class ExhaustivePage(Page):
     element = Element(Locators.NAME, "e1")
     element_invalid = Element(Locators.NAME, "3e")
     elements = Elements(Locators.NAME, "e2")
     elements_invalid = Elements(Locators.NAME, "3e")
     elementmap = ElementMap(Locators.NAME, "e3")
     elementmap_for_ref = ElementMap(Locators.NAME, "e2")
     elementmap_invalid = ElementMap(Locators.NAME, "3e")
     elementmap_raw = {
         "e4": Element(Locators.NAME, "e4"),
         "e2": Elements(Locators.NAME, "e2"),
         "e3": ElementMap(Locators.NAME, "e3")
     }
     elements_raw = [
         Element(Locators.NAME, "e4"),
         Elements(Locators.NAME, "e2"),
         ElementMap(Locators.NAME, "e3")
     ]
     element_list_raw = [
         Element(Locators.NAME, "e4"),
         Element(Locators.NAME, "e6")
     ]
     element_map_raw = {
         "e4": Element(Locators.NAME, "e4"),
         "e6": Element(Locators.NAME, "e6")
     }
     element_second = Element(Locators.NAME, "e2")
     element_ref = Element(Locators.NAME,
                           "e6",
                           base_element=elements[0])
     element_map_ref = Element(
         Locators.NAME,
         "e6",
         base_element=elementmap_for_ref["e2 - 1\ne6"])
     element_ref_direct = Element(Locators.NAME,
                                  "e6",
                                  base_element=element_second)
     element_ref_webelement = Element(Locators.NAME,
                                      "e6",
                                      base_element=web_element)
     element_ref_invalid = Element(Locators.NAME, "e6", base_element=42)
class AlbelliHomePage(Page):
    home_page_banner = Element(Locators.ID, 'hero-shot', timeout=5)