How to use the splinter.exceptions.ElementDoesNotExist function in splinter

To help you get started, we’ve selected a few splinter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cobrateam / splinter / splinter / driver / zopetestbrowser.py View on Github external
def _is_text_present(self, text):
        try:
            body = self.find_by_tag("body").first
            return text in body.text
        except ElementDoesNotExist:
            # This exception will be thrown if the body tag isn't present
            # This has occasionally been observed. Assume that the
            # page isn't fully loaded yet
            return False
github cobrateam / splinter / tests / test_element_list.py View on Github external
def test_raise_exception_on_indexerror_with_unicode_query(self):
        "should raise ElementDoesNotExist exception on IndexError"
        with self.assertRaises(ElementDoesNotExist):
            ElementList([], query=u".element[title=título]").first
github cobrateam / splinter / tests / element_does_not_exist.py View on Github external
def test_element_list_raises_with_unicode_query(self):
        with self.assertRaises(ElementDoesNotExist):
            self.browser.find_by_css(u".element[title=título]").last
github cobrateam / splinter / tests / element_does_not_exist.py View on Github external
def test_element_query_should_raises_when_element_first_doest_exists(self):
        with self.assertRaises(ElementDoesNotExist):
            self.browser.find_by_css(".element-that-dont-exists").first
github cobrateam / splinter / tests / test_element_list.py View on Github external
def test_raise_exception_on_indexerror(self):
        "should raise ElementDoesNotExist exception on IndexError"
        with self.assertRaises(ElementDoesNotExist):
            ElementList([]).first
github ggozad / behaving / src / behaving / web / steps / forms.py View on Github external
def i_select(context, value, name):
    try:
        context.browser.select(name, value)
    except ElementDoesNotExist:
        inp = context.browser.find_by_xpath("//input[@name='%s'][@value='%s']" % (name, value))
        assert inp, u'Element not found'
        inp.first.check()
github cobrateam / splinter / splinter / element_list.py View on Github external
def __getitem__(self, index):
        if not isinstance(index, int) and not isinstance(index, slice):
            return self.first[index]
        try:
            return self._container[index]
        except IndexError:
            raise ElementDoesNotExist(
                u'no elements could be found with {0} "{1}"'.format(
                    self.find_by, self.query
                )
github cobrateam / splinter / splinter / driver / lxmldriver.py View on Github external
def _is_text_present(self, text):
        try:
            body = self.find_by_tag("body").first
            return text in body.text
        except ElementDoesNotExist:
            # This exception will be thrown if the body tag isn't present
            # This has occasionally been observed. Assume that the
            # page isn't fully loaded yet
            return False
github ggozad / behaving / src / behaving / mobile / steps / basic.py View on Github external
def set_variable(context, key, chain):
    assert isinstance(
        context.browser,
        IOSWebDriver), 'iOS class chain only available on iOS devices'
    assert context.persona is not None, u'no persona is setup'
    try:
        context.persona[key] = context.browser.find_by_ios_class_chain(
            chain).first.get_attribute('value')
    except ElementDoesNotExist:
        assert False, u'Element not found'
github ggozad / behaving / src / behaving / web / steps / variables.py View on Github external
def set_key_to_xpath_attr(context, key, attr, xpath):
    assert context.persona is not None, u'no persona is setup'
    try:
        el = context.browser.find_by_xpath(xpath)
    except ElementDoesNotExist:
        assert False, u'Element not found'

    context.persona[key] = el.first[attr] or ''