18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Checking the active tab

SadanaSadana Members
edited May 2013 in Sahi - Open Source
Hi!

I'm having problems to find out if the tab is active or no. In the web page there is 4-5 different tabs.
Here's the part of the element of tab, where it's mentioned if it is active.

<section ng-controller="BasicInformationCtrl" class="ng-scope active" style="padding-top: 49px;">

My problem is that how I can get that information out so that I can use them in my verifications?

I'm using Sahi Java driver.

Best Answers

  • edited May 2013 Answer ✓
    Hi
    $tabs = _collect( "_div", "/./", _in($navBar));
    for $element in $tabs
      if $element.class.indexOf("active") then return element
    

    Just pseudocode, but I hope it gives you the right directions.

    Regards
    Wormi
  • Answer ✓
    Here's the solution I finally used to check which tab is active.

    The first tab was the trickiest because it didn't have any ID. So I decided to check if some information existing only on that tab is visible.

    browser.heading6("Unique title").isVisible()

    For the rest of the tabs case was easier because I noticed they have ID. so basically checking was following:

    browser.byId("Unique ID of tab").fetch("className").contains("active")

Answers

  • SadanaSadana Members
    It gives some idea where to start to look the answer.
    Only thing is that with Sahi java driver there is no _collect available. The closest method is collectSimilar(). Now I have to study if that is able to do the same trick.
  • SadanaSadana Members
    Unfortunately it looks like I'm too newbie to solve this problem. I tried to use collectSimilar(), but all I got was just errors. "tagName.toLowerCase is not function"
Sign In or Register to comment.