# Using 'get\_active\_tab\_index' in nested Tab Containers

**URL:** <https://forum.inductiveautomation.com/t/using-get-active-tab-index-in-nested-tab-containers/85671>\
**Category:** Automated Testing\
**Tags:** perspective, ignition81\
**Created:** [February 14, 2024, 6:06am UTC](https://forum.inductiveautomation.com/t/using-get-active-tab-index-in-nested-tab-containers/85671 "2024-02-14T06:06:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Sadleir](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@Daniel\_Sadleir](https://forum.inductiveautomation.com/u/Daniel_Sadleir)\
**Post date:** [February 14, 2024, 6:06am UTC](https://forum.inductiveautomation.com/t/using-get-active-tab-index-in-nested-tab-containers/85671/1 "2024-02-14T06:06:15Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 14, 2024, 6:51am UTC](https://forum.inductiveautomation.com/t/using-get-active-tab-index-in-nested-tab-containers/85671/2 "2024-02-14T06:51:54Z")

</div>

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:

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

```

Should be this:

```python
        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.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 16, 2024, 10:34pm UTC](https://forum.inductiveautomation.com/t/using-get-active-tab-index-in-nested-tab-containers/85671/3 "2024-02-16T22:34:26Z")

</div>

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.
