Skip to content

Problem with setting library search order #19

@soyacz

Description

@soyacz

Hi Brayan,
I'm having problems with error "AttributeError: 'tuple' object has no attribute 'split'"
Issue occurs when I use a few times "Go To Page" keyword e.g:

Valid Credentials Should Log User In
    Go to page    ThanksArticlesListPage
    Go to page    LoginPage
    Submit Valid Credentials
    The current page should be    ThanksArticlesListPage
    Go to page    LoginPage
    Submit Valid Credentials
    User Name Should Be Visible On The Navigation Panel

I'm using Mixin class in my page objects like in one of your tutorials.

Anyway, I think I've found solution, but I'm not permitted to push into your repo. So I'm pasting fix here:
robotframework-pageobjectlibrary/PageObjectLibrary/keywords.py

    def the_current_page_should_be(self, page_name):
        """Fails if the name of the current page is not the given page name

        ``page_name`` is the name you would use to import the page.

        This keyword will import the given page object, put it at the
        front of the Robot library search order, then call the method
        ``_is_current_page`` on the library. The default
        implementation of this method will compare the page title to
        the ``PAGE_TITLE`` attribute of the page object, but this
        implementation can be overridden by each page object.

        """

        page = self._get_page_object(page_name)

        # This causes robot to automatically resolve keyword
        # conflicts by looking in the current page first.
        if page._is_current_page():
            # only way to get the current order is to set a
            # new order. Once done, if there actually was an
            # old order, preserve the old but make sure our
            # page is at the front of the list
            old_order = self.builtin.set_library_search_order()
            new_order = (str(page),) + old_order
            self.builtin.set_library_search_order(*new_order)
            return

        # If we get here, we're not on the page we think we're on
        raise Exception("Expected page to be %s but it was not" % page_name)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions