Exemple #1
0
    def test_has_element(self):
        self.driver.set_dom_element([By.ID, 'an_id'])
        component = UIComponent(self.driver, 'a_component', [By.ID, 'an_id'])
        self.driver.set_dom_element([By.XPATH, './/option'], parent_id=[By.ID, 'dropdownlocator'], children=1,
                                    return_values=[])

        self.driver.set_expected_command(Command.FIND_CHILD_ELEMENTS, {'using': By.ID, 'value': self.driver.
                                         get_id_for_stored_element([By.ID, 'an_id']),
                                         'id': 'id', "sessionId": self.driver.session_id})
        ##
        component.has_element([By.ID, 'another_id'])
        ##
        assert_that(self.driver.has_fulfilled_expectations(), equal_to(True),
                    "component should be able to locate element it is scope")
Exemple #2
0
    def test_has_element(self):
        self.driver.set_dom_element([By.ID, 'an_id'])
        component = UIComponent(self.driver, 'a_component', [By.ID, 'an_id'])
        self.driver.set_dom_element([By.XPATH, './/option'],
                                    parent_id=[By.ID, 'dropdownlocator'],
                                    children=1,
                                    return_values=[])

        self.driver.set_expected_command(
            Command.FIND_CHILD_ELEMENTS, {
                'using': By.ID,
                'value': self.driver.get_id_for_stored_element(
                    [By.ID, 'an_id']),
                'id': 'id',
                "sessionId": self.driver.session_id
            })
        ##
        component.has_element([By.ID, 'another_id'])
        ##
        assert_that(self.driver.has_fulfilled_expectations(), equal_to(True),
                    "component should be able to locate element it is scope")