1

I have the following CSS (Note the element that tells me it's an active element.):

<div class=Tabs>
<div class="Tab-module" style="max-width: 400px;"><div class="Tabs-module__tab Tab-module__active">
</div>
<div class="Tab-module" style="max-width: 400px;"><div class="Tabs-module__tab" >
</div>
</div>
[FindsBy(How = How.CssSelector, Using = "[class^='main-header'] [class^='Tabs'] [class='Tab-module']")]
private IList<IWebElement> Workspaces { set; get; }

This gives me 2x 'Tab-module'. Now, when I call the following code:

Workspaces.Select(thisWorkspace=>new Workspace(thisWorkspace)).ToList()

Where the constructor looks like the following :

public Workspace(ISearchContext searchContext)
{
       protected By isActive = By.CssSelector("[class*='Tab-module__active']
       PageFactory.InitElements(searchContext, this);

       try
       {
           var parent = searchContext.FindElement(isActive);
       }
       catch
       {
           IsActive = false;
       }
}

I want to be able to find out if the thisWorkspace object I'm passing in has the sibling class - Tab-module__active. I can't traverse up to the parent as this would always locate the sibling class - no matter what element I'm passing into Workspace.

Can someone help me as to what the best approach would be for this situation as I'm really stuck on this one.

Thanks.

0 Answers0