Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with setting library search order #19

Open
soyacz opened this issue Jul 20, 2019 · 0 comments
Open

Problem with setting library search order #19

soyacz opened this issue Jul 20, 2019 · 0 comments

Comments

@soyacz
Copy link

soyacz commented Jul 20, 2019

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant