Using 'get_active_tab_index' in nested Tab Containers

I've been using Selenium, Chrome, and pytest to test a client system with these tools.

When using nested Tab Containers, the 'get_active_tab_index' from Tab.py seems to be returning the active tab of the Parent container rather than the container specified.

While debugging it looked like find() was just grabbing the first instance; using find_all() let me specify which container I wanted, and then I could return the index I was expecting.

Finding the element again with the driver and using '.get_attribute("data-tab-index"))' seems to work for me for now. If anyone finds a better solution or something I'm missing let me know!

Ah. Yep. An oversight on our end, likely never caught as we're not testing any Tab-in-Tab scenarios.

It's a result of how we construct the locator for the _active_tab ComponentPiece:

        self._active_tab = ComponentPiece(
            locator=self._ACTIVE_TAB_LOCATOR,
            driver=driver,
            parent_locator_list=None,
            poll_freq=poll_freq)

Should be this:

        self._active_tab = ComponentPiece(
            locator=self._ACTIVE_TAB_LOCATOR,
            driver=driver,
            parent_locator_list=self.locator_list,
            poll_freq=poll_freq)

I'll make a ticket to get it fixed, but the earliest version which would have the fix would be... 8.1.38.

We've merged a fix for this into our project and it will be available within the 8.1.38 release in the coming weeks.

2 Likes