Example #1
0
def test_get_suitable_action_appropriately_for_page_actions_ptbr():
    # Reset action regexes (this is necessary because pyccuracy was not built
    # to run 2 different languages in the same execution, then we do this to 
    # allow appropriate testing)
    PageGoToAction.regex = LanguageItem('page_go_to_regex')
    PageGoToWithParametersAction.regex = LanguageItem('page_go_to_with_parameters_regex')
    
    Action, args, kw = ActionRegistry.suitable_for(u'Eu navego para Uma Pagina', 'pt-br')
    assert issubclass(Action, PageGoToAction)
    assert kw['url'] == u'Uma Pagina'

    Action, args, kw = ActionRegistry.suitable_for(u'Eu navego para Pagina de Blog do usuario "nome"', 'pt-br')
    assert issubclass(Action, PageGoToWithParametersAction)
    assert kw['url'] == u'Pagina de Blog'
    assert kw['parameters'] == u'usuario "nome"'

    Action, args, kw = ActionRegistry.suitable_for(u'Eu navego para Pagina de Busca para query "palavra"', 'pt-br')
    assert issubclass(Action, PageGoToWithParametersAction)
    assert kw['url'] == u'Pagina de Busca'
    assert kw['parameters'] == u'query "palavra"'

    Action, args, kw = ActionRegistry.suitable_for(u'Eu navego para Pagina de Config com parameter1 "value1", parameter2 "value2"', 'pt-br')
    assert issubclass(Action, PageGoToWithParametersAction)
    assert kw['url'] == u'Pagina de Config'
    assert kw['parameters'] == u'parameter1 "value1", parameter2 "value2"'
Example #2
0
class ElementContainsStyleAction(ActionBase):
    '''h3. Examples

  * And I see "some" textbox has "width" style
  * And I see "other" button has "visible" style

h3. Description

This action asserts that the given element has the given style with any value.'''
    __builtin__ = True
    regex = LanguageItem('element_contains_style_regex')

    def execute(self, context, element_type, element_name, style_name):
        element_key = resolve_element_key(context, element_type, element_name,
                                          self.resolve_element_key)

        error_message = context.language.format("element_is_visible_failure",
                                                element_type, element_name)
        self.assert_element_is_visible(context, element_key, error_message)

        current_style = context.browser_driver.get_class(element_key) or ""
        styles = current_style.split(" ")

        if style_name not in styles:
            error_message = context.language.format(
                "element_contains_style_failure", element_type, element_name,
                style_name)
            raise self.failed(error_message)
Example #3
0
class ElementWaitForDisappearAction(ActionBase):
    '''h3. Examples

  * And I wait for "some" button element to disappear
  * And I wait for "other" textbox element to disappear for 5 seconds

h3. Description

Waits until a given element disappears (or is not visible already) or times out.

This action is really useful when you have some processing done (maybe AJAX) before an element is dynamically removed or hidden.
    '''
    __builtin__ = True
    regex = LanguageItem("element_wait_for_disappear_regex")

    def execute(self, context, element_type, element_name, timeout):
        element_key = resolve_element_key(context, element_type, element_name,
                                          self.resolve_element_key)

        if not timeout:
            timeout = 5
        timeout = int(timeout)

        if not context.browser_driver.wait_for_element_to_disappear(
                element_key, timeout):
            error_message = context.language.format(
                "element_wait_for_disappear_failure", element_type,
                element_name, timeout, element_key)
            raise self.failed(error_message)
Example #4
0
class ElementClickAction(ActionBase):
    '''h3. Examples

  * And I click "some" button
  * And I click "other" checkbox and wait

h3. Description

This action instructs the browser driver to click the given element. If the "and wait" suffix is used, a "Wait for page to load" action is executed after this one.'''
    __builtin__ = True
    regex = LanguageItem('element_click_regex')

    def execute(self, context, element_type, element_name, should_wait):
        element_key = resolve_element_key(context, element_type, element_name,
                                          self.resolve_element_key)

        error_message = context.language.format("element_is_visible_failure",
                                                element_type, element_name)
        self.assert_element_is_visible(context, element_key, error_message)
        context.browser_driver.click_element(element_key)

        if (should_wait):
            timeout = 30000
            try:
                context.browser_driver.wait_for_page(timeout=timeout)
            except Exception, error:
                if str(error) == "Timed out after %dms" % timeout:
                    raise self.failed(
                        context.language.format("timeout_failure", timeout))
                else:
                    raise
Example #5
0
class PageAmInAction(ActionBase):
    '''h3. Example

  * And I am in My Custom Page

h3. Description

This action tells Pyccuracy that it should change the current page (as far as registered elements and url go) to a given page.

The same rule for direct urls of Go to Page applies to this action.

Other than that, this action does not do anything. The main purpose of this action is responding to some client event or redirect that might have changed the current page without our direct action (like submitting a form that redirects us to a different page).'''
    __builtin__ = True
    regex = LanguageItem("page_am_in_regex")

    def execute(self, context, url):
        page, resolved_url = PageRegistry.resolve(context.settings,
                                                  url,
                                                  must_raise=False)

        if page:
            # If the resolved page is the same as the current one,
            # there's not need to override the context page, risking
            # losing all the re-registered elements of the users.
            if not isinstance(context.current_page, page):
                context.current_page = page()
                if hasattr(context.current_page, "register"):
                    context.current_page.register()
            context.url = resolved_url
        else:
            raise self.failed(
                context.language.format("page_am_in_failure", url))
Example #6
0
class ElementDragAction(ActionBase):
    '''h3. Example

  * I drag the "from" div to the "target" div

h3. Description

This action instructs the browser driver to drag the "from" element to the "target" element.'''
    __builtin__ = True
    regex = LanguageItem("element_drag_drop_regex")

    def execute(self, context, from_element_type, from_element_name,
                to_element_type, to_element_name):
        from_element_key = resolve_element_key(context, from_element_type,
                                               from_element_name,
                                               self.resolve_element_key)
        to_element_key = resolve_element_key(context, to_element_type,
                                             to_element_name,
                                             self.resolve_element_key)

        error_message = context.language.get(
            "element_is_not_visible_for_drag_failure")
        self.assert_element_is_visible(context, from_element_key,
                                       error_message % from_element_key)
        self.assert_element_is_visible(context, to_element_key,
                                       error_message % to_element_key)

        context.browser_driver.drag_element(from_element_key, to_element_key)
Example #7
0
class ElementContainsTextAction(ActionBase):
    '''h3. Example

  * I see "username" textbox contains "polo"

h3. Description

This action asserts that the text for the given element contains the specified one.'''
    __builtin__ = True
    regex = LanguageItem("element_contains_text_regex")

    def execute(self, context, element_type, element_name, text):
        element_key = resolve_element_key(context, element_type, element_name,
                                          self.resolve_element_key)

        error_message = context.language.format("element_is_visible_failure",
                                                element_type, element_name)
        self.assert_element_is_visible(context, element_key, error_message)

        current_text = context.browser_driver.get_element_text(element_key)
        if (not current_text) or (not text in current_text):
            error_message = context.language.format(
                "element_contains_text_failure", element_type, element_name,
                text, current_text)
            raise self.failed(error_message)
Example #8
0
class ElementDoesNotMatchTextAction(ActionBase):
    '''h3. Example

  * I see "username" textbox matches "polo"

h3. Description

This action asserts that the text for the given element does not match exactly the specified one.'''
    __builtin__ = True
    regex = LanguageItem("element_does_not_match_text_regex")

    def execute(self, context, element_type, element_name, text):
        element_key = resolve_element_key(context, element_type, element_name,
                                          self.resolve_element_key)

        error_message = context.language.format("element_is_visible_failure",
                                                element_type, element_name)
        self.assert_element_is_visible(context, element_key, error_message)

        current_text = context.browser_driver.get_element_text(element_key)
        if current_text and text.strip() == current_text.strip():
            error_message = context.language.format(
                "element_does_not_match_text_failure", element_type,
                element_name, text, current_text)
            raise self.failed(error_message)
Example #9
0
class SelectDoesNotContainOptionWithTextAction(ActionBase):
    '''h3. Example

  * And I see "sports" select does not contain an option with text "soccer"

h3. Description

This action asserts that the specified select does not contain any options with the specified text.'''
    __builtin__ = True
    regex = LanguageItem("select_does_not_contain_option_with_text_regex")

    def execute(self, context, select_name, text):
        select = resolve_element_key(context, Page.Select, select_name, self.resolve_element_key)

        error_message = context.language.format("element_is_visible_failure", Page.Select, select_name)

        self.assert_element_is_visible(context, select, error_message)

        options = context.browser_driver.get_select_options(select)

        found = text in options
        
        if found:
            error_message = context.language.format("select_does_not_contain_option_with_text_failure", select_name, text)
            raise self.failed(error_message)
Example #10
0
class ElementDoesNotMatchMarkupAction(ActionBase):
    '''h3. Example

  * I see "username" textbox does not match "<p>polo</p>" markup

h3. Description

This action asserts that the markup for the given element does not match exactly the specified one.'''
    __builtin__ = True
    regex = LanguageItem("element_does_not_match_markup_regex")

    def execute(self, context, element_type, element_name, markup):
        element_key = resolve_element_key(context, element_type, element_name,
                                          self.resolve_element_key)

        error_message = context.language.format("element_is_visible_failure",
                                                element_type, element_name)
        self.assert_element_is_visible(context, element_key, error_message)

        current_markup = context.browser_driver.get_element_markup(element_key)
        if current_markup and markup.strip() == current_markup.strip():
            error_message = context.language.format(
                "element_does_not_match_markup_failure", element_type,
                element_name, markup, current_markup)
            raise self.failed(error_message)
Example #11
0
class PageGoToWithParametersAction(PageGoToAction):
    '''h3. Examples

  * And I go to Profile Page of user "name"
  * And I go to Config Page for user "name"
  * And I go to Search Page with query "apple", order "desc", page "10"

h3. Description

This action does the same thing as the *"I go to [page]"* but allows you to have variable URLs and pass parameters to be included in them. You can pass as many parameters as you want using commas.

For instance, the examples above will access pages with the following URLs (respectively):

  * url = "/<user>"
  * url = "/config/<user>"
  * url = "/search.php?q=<query>&order=<order>&p=<page>"

Parameters will be automatically included in the URL when you call these pages. For more information on creating custom pages check the [[Creating custom Pages]] page.
'''
    __builtin__ = True
    regex = LanguageItem('page_go_to_with_parameters_regex')

    def execute(self, context, url, parameters):
        page, resolved_url = self.resolve_url(context, url)
        params = self.parse_parameters(context, parameters)
        resolved_url = self.replace_url_paremeters(resolved_url, params)
        super(PageGoToWithParametersAction,
              self).go_to_page(context, url, page, resolved_url)

    def parse_parameters(self, context, parameters):
        params = {}
        pattern = re.compile(r'^(.+)\s\"(.+)\"$')
        for item in [param.strip() for param in parameters.split(',')]:
            match = pattern.match(item)
            if not match:
                raise self.failed(
                    context.language.format(
                        "page_go_to_with_parameters_failure", parameters))
            params[match.group(1)] = match.group(2)
        return params

    def replace_url_paremeters(self, url, parameters):
        resolved_url = url
        for item in parameters.keys():
            resolved_url = resolved_url.replace('<%s>' % item,
                                                parameters[item])
        return resolved_url
Example #12
0
class PageSeeTitleAction(ActionBase):
    '''h3. Example

  * And I see "whatever" title

h3. Description

This action asserts that the currently loaded page's title (Browser title) is the specified one. '''
    __builtin__ = True
    regex = LanguageItem("page_see_title_regex")

    def execute(self, context, title):
        actual_title = context.browser_driver.get_title()
        if (actual_title != title):
            msg = context.language.format("page_see_title_failure",
                                          actual_title, title)
            raise self.failed(msg)
Example #13
0
class TextboxCleanAction(ActionBase):
    '''h3. Example

  * And I clean "details" textbox

h3. Description

This action cleans the given textbox (empties any text inside of it).'''
    __builtin__ = True
    regex = LanguageItem("textbox_clean_regex")

    def execute(self, context, textbox_name):
        textbox = self.resolve_element_key(context, Page.Textbox, textbox_name)

        error_message = context.language.format("element_is_visible_failure", "textbox", textbox_name)
        self.assert_element_is_visible(context, textbox, error_message)
        context.browser_driver.clean_input(textbox)
Example #14
0
class TextboxTypeAction(ActionBase):
    '''h3. Example

  * And I fill "details" textbox with "text"

h3. Description

This action types the given text in the given textbox.'''
    __builtin__ = True
    regex = LanguageItem("textbox_type_regex")

    def execute(self, context, textbox_name, text):
        textbox_key = self.resolve_element_key(context, Page.Textbox, textbox_name)

        error_message = context.language.format("element_is_visible_failure", "textbox", textbox_name)
        self.assert_element_is_visible(context, textbox_key, error_message)
        context.browser_driver.type_text(textbox_key, text)
Example #15
0
class TableMatchAction(ActionBase):
    '''h3. Example

  * And I see "some" table as:
        | Name | Age | Sex  |
        | John | 28  | Male |
        | Paul | 30  | Male | 

h3. Description

This action asserts that the given table matches the one the user specified.'''
    __builtin__ = True
    regex = LanguageItem("table_match_regex")

    def execute(self, context, table_name, table):
        element_type = Page.Table
        element_key = self.resolve_element_key(context, element_type, table_name)

        error_message = context.language.format("element_is_visible_failure", "table", table_name)
        self.assert_element_is_visible(context, element_key, error_message)

        rows = context.browser_driver.get_table_rows(element_key)

        error_table_keys = " | ".join(table[0].keys())
        error_table_format = "\n".join([" | ".join(item.values()) for item in table])
        error_rows_format = [" | ".join(item) for item in rows]
        error_message = context.language.format(
                                            "table_invalid_data_failure", 
                                            table_name, 
                                            error_table_keys,
                                            error_table_format, 
                                            error_rows_format)
                
        if not rows or len(rows) <= len(table) :
            raise self.failed(error_message)
        
        actual_keys = rows[0]
        
        for row_index, row in enumerate(rows[1:]):
            if len(row) != len(actual_keys):
                raise self.failed(error_message)
                 
            for cell_index, cell in enumerate(row):
                if cell != table[row_index][actual_keys[cell_index]]:
                    raise self.failed(error_message)
Example #16
0
class PageCheckDoesNotContainMarkupAction(ActionBase):
    '''h3. Example

  * And I see that current page does not contain "&lt;p&gt;expected markup&lt;/p&gt;"

h3. Description

This action asserts that the currently loaded page's mark-up *does not* contain the given mark-up.'''
    __builtin__ = True
    regex = LanguageItem("page_check_does_not_contain_markup_regex")

    def execute(self, context, expected_markup):
        html = context.browser_driver.get_html_source()

        if expected_markup in html:
            msg = context.language.format(
                "page_check_does_not_contain_markup_failure", expected_markup)
            raise self.failed(msg)
Example #17
0
class ElementIsNotVisibleAction(ActionBase):
    '''h3. Examples

  * And I do not see "some" button
  * And I do not see "other" checkbox

h3. Description

This action asserts that the given element is not visible.'''
    __builtin__ = True
    regex = LanguageItem('element_is_not_visible_regex')

    def execute(self, context, element_type, element_name):
        element_key = resolve_element_key(context, element_type, element_name,
                                          self.resolve_element_key)

        error_message = context.language.format(
            "element_is_not_visible_failure", element_type, element_name)
        self.assert_element_is_not_visible(context, element_key, error_message)
Example #18
0
class PageGoToAction(ActionBase):
    '''h3. Examples

  * And I go to My Custom Page
  * And I go to "http://www.google.com"

h3. Description

This action tells Pyccuracy that the current browser driver ([[Creating a custom Browser Driver]]) should navigate to the URL that's registered in the specified page. Other than that, it also changes that current page in Pyccuracy's context to the specified one. This means that Pyccuracy will start using the registered elements and url in the specified page. 

For more information on creating custom pages check the [[Creating custom Pages]] page.

If you specify an url directly, Pyccuracy sets the current page to None and you can't use registered elements. That might make sense for some scenarios, but is the least preferred way of using this action.

This action also issues automatically a wait for page to load action after navigating. This is important to make sure that the following actions work with a properly loaded page.'''
    __builtin__ = True
    regex = LanguageItem('page_go_to_regex')

    def execute(self, context, url):
        page, resolved_url = self.resolve_url(context, url)
        self.go_to_page(context, url, page, resolved_url)

    def resolve_url(self, context, url):
        return PageRegistry.resolve(context.settings,
                                    url.replace('"', ''),
                                    must_raise=False)

    def go_to_page(self, context, url, page, resolved_url):
        if not resolved_url or (not url.startswith('"') and not page):
            raise self.failed(
                context.language.format("page_go_to_failure", url))

        context.browser_driver.page_open(resolved_url)
        context.browser_driver.wait_for_page()
        context.url = resolved_url
        if page:
            # If the resolved page is the same as the current one,
            # there's not need to override the context page, risking
            # losing all the re-registered elements of the users.
            if not isinstance(context.current_page, page):
                context.current_page = page()
                if hasattr(context.current_page, "register"):
                    context.current_page.register()
Example #19
0
class ElementMouseOutAction(ActionBase):
    '''h3. Example

  * And I mouseout "some" image

h3. Description

This action instructs the browser driver to remove mouse focus from the specified element.'''
    __builtin__ = True
    regex = LanguageItem("element_mouseout_regex")

    def execute(self, context, element_type, element_name):
        element_key = resolve_element_key(context, element_type, element_name,
                                          self.resolve_element_key)

        error_message = context.language.format("element_is_visible_failure",
                                                element_type, element_name)
        self.assert_element_is_visible(context, element_key, error_message)
        context.browser_driver.mouseout_element(element_key)
Example #20
0
class CheckboxUncheckAction(ActionBase):
    '''h3. Example

  * And I uncheck the "book" checkbox

h3. Description

This action unchecks the given checkbox.'''
    __builtin__ = True
    regex = LanguageItem("checkbox_uncheck_regex")

    def execute(self, context, checkbox_key):
        element_type = "checkbox"
        element_key = self.resolve_element_key(context, element_type,
                                               checkbox_key)

        error_message = context.language.format("element_is_visible_failure",
                                                element_type, checkbox_key)
        self.assert_element_is_visible(context, element_key, error_message)
        context.browser_driver.checkbox_uncheck(element_key)
Example #21
0
class TextboxTypeSlowlyAction(ActionBase):
    '''h3. Example

  * And I slowly fill "details" textbox with "text"

h3. Description

This action types the given text in the given textbox. The difference between "slowly" typing and the regular typing is that this action raises javascript "key" events (keyUp, keyDown, etc).'''
    __builtin__ = True
    regex = LanguageItem("textbox_type_keys_regex")

    def execute(self, context, textbox_name, text):
        if context.settings.browser_to_run == "safari":
            # Needed to work on Safari/Mac OS - Selenium bug?
            # I observed that it's only possible to type_keys after type_text once.
            TextboxTypeAction().execute(context, textbox_name, text)
        
        # now typyng slowly...
        textbox_key = self.resolve_element_key(context, Page.Textbox, textbox_name)
        context.browser_driver.type_keys(textbox_key, text)
Example #22
0
class RadioCheckAction(ActionBase):
    '''h3. Example

  * And I check the "credit card" radio

h3. Description

This action marks the given radio button.'''
    __builtin__ = True
    regex = LanguageItem("radio_check_regex")

    def execute(self, context, radio_key):
        element_type = "radio"
        element_key = self.resolve_element_key(context, element_type,
                                               radio_key)

        error_message = context.language.format("element_is_visible_failure",
                                                element_type, radio_key)
        self.assert_element_is_visible(context, element_key, error_message)
        context.browser_driver.radio_check(element_key)
Example #23
0
class SelectHasSelectedIndexAction(ActionBase):
    '''h3. Example

  * And I see "sports" select has selected index of 1

h3. Description

This action asserts that the currently selected option in the specified select has the specified index.'''
    __builtin__ = True
    regex = LanguageItem("select_has_selected_index_regex")

    def execute(self, context, select_name, index):
        select = resolve_element_key(context, Page.Select, select_name, self.resolve_element_key)
        error_message = context.language.format("element_is_visible_failure", Page.Select, select_name)
        self.assert_element_is_visible(context, select, error_message)
        
        selected_index = context.browser_driver.get_selected_index(select)

        if (int(selected_index) != int(index)):
            error_message = context.language.format("select_has_selected_index_failure", select_name, index, selected_index)
            raise self.failed(error_message)
Example #24
0
class SelectHasSelectedValueAction(ActionBase):
    '''h3. Example

  * And I see "sports" select has selected value of "1"

h3. Description

This action asserts that the currently selected option in the specified select has the specified value.'''
    __builtin__ = True
    regex = LanguageItem("select_has_selected_value_regex")

    def execute(self, context, select_name, option_value):
        select = resolve_element_key(context, Page.Select, select_name, self.resolve_element_key)
        error_message = context.language.format("element_is_visible_failure", Page.Select, select_name)
        self.assert_element_is_visible(context, select, error_message)
        
        selected_value = context.browser_driver.get_selected_value(select)

        if (unicode(selected_value) != unicode(option_value)):
            error_message = context.language.format("select_has_selected_value_failure", select_name, option_value, selected_value)
            raise self.failed(error_message)
Example #25
0
def test_action_registry_suitable_for_raises_when_language_getter_can_not_resolve(
):

    mocker = Mocker()

    class MyActionLanguage(ActionBase):
        regex = LanguageItem('foo_bar_regex1')

        def execute(self, context, *args, **kw):
            pass

    language_getter_mock = mocker.mock()
    language_getter_mock.get(LanguageItem('foo_bar_regex1'))
    mocker.result(None)
    language_getter_mock.get(ANY)
    mocker.count(min=1, max=None)
    mocker.result('^$')

    with mocker:
        Action, args, kwargs = ActionRegistry.suitable_for(
            'Something blabla', 'en-us', getter=language_getter_mock)
Example #26
0
def test_action_registry_suitable_for_returns_my_action():

    mocker = Mocker()

    class MyAction(ActionBase):
        regex = LanguageItem('foo_bar_regex')

        def execute(self, context, *args, **kw):
            pass

    language_getter_mock = mocker.mock()
    language_getter_mock.get(LanguageItem('foo_bar_regex'))
    mocker.result('My regex .+')
    language_getter_mock.get(ANY)
    mocker.count(min=1, max=None)
    mocker.result('^$')

    with mocker:
        Action, args, kwargs = ActionRegistry.suitable_for(
            'My regex baz', 'en-us', getter=language_getter_mock)
        assert Action is MyAction
Example #27
0
class PageWaitForSecondsAction(ActionBase):
    '''h3. Examples

  * And I wait for 5 seconds
  * And I wait for 1 second
  * And I wait for 3.5 seconds

h3. Description

This action is just a proxy to Python's time.sleep function. It just hangs for a given number of seconds.'''
    __builtin__ = True
    regex = LanguageItem("page_wait_for_seconds_regex")

    def execute(self, context, timeout):
        try:
            timeout = float(timeout)
        except ValueError:
            raise self.failed(
                "The specified time cannot be parsed into a float number: %s" %
                timeout)

        time.sleep(timeout)
Example #28
0
class LinkHasHrefOfAction(ActionBase):
    '''h3. Example

  * And I see "logout" link has "/app/logout" href

h3. Description

This action asserts that a link has the given href attribute.'''
    __builtin__ = True
    regex = LanguageItem("link_has_href_regex")

    def execute(self, context, link_name, href):
        link = self.resolve_element_key(context, Page.Link, link_name)

        error_message = context.language.format("element_is_visible_failure", "link", link_name)
        self.assert_element_is_visible(context, link, error_message)

        current_href = context.browser_driver.get_link_href(link)

        if not current_href or current_href.lower().find(href.lower()) == -1:
            error_message = context.language.format("link_has_href_failure", link_name, href, current_href)
            raise self.failed(error_message)
Example #29
0
class SelectOptionByTextAction(ActionBase):
    '''h3. Example

  * And I select the option with text of "soccer" in "sports" select

h3. Description

This action instructs the browser driver to select the option in the specified select with the specified text.'''
    __builtin__ = True
    regex = LanguageItem("select_option_by_text_regex")

    def execute(self, context, select_name, text):
        select_key = resolve_element_key(context, Page.Select, select_name, self.resolve_element_key)

        error_message = context.language.format("element_is_visible_failure", Page.Select, select_name)
        self.assert_element_is_visible(context, select_key, error_message)
        
        result = context.browser_driver.select_option_by_text(select_key, text)
        
        if not result:
            error_message = context.language.format("select_option_by_text_failure", select_name, text)
            raise self.failed(error_message)
Example #30
0
class SelectDoesNotHaveSelectedTextAction(ActionBase):
    '''h3. Example

  * And I see "sports" select does not have selected text of "soccer"

h3. Description

This action asserts that the currently selected option in the specified select does not have the specified text.'''
    __builtin__ = True
    regex = LanguageItem("select_does_not_have_selected_text_regex")

    def execute(self, context, select_name, text):
        select = resolve_element_key(context, Page.Select, select_name, self.resolve_element_key)

        error_message = context.language.format("element_is_visible_failure", Page.Select, select_name)
        self.assert_element_is_visible(context, select, error_message)

        selected_text = context.browser_driver.get_selected_text(select)

        if (selected_text == text):
            error_message = context.language.format("select_does_not_have_selected_text_failure", select_name, text, selected_text)
            raise self.failed(error_message)