Skip to content

Issue when finding element using custom XPATH #1917

@naveen-hitachi

Description

@naveen-hitachi

In Seleniumbase, when using this XPATH //*[text() = 'Alarm'] Element is visible
But the same element written like this is not present: //a[@aria-expanded='false' or not(@aria-expanded)]//*[text() = 'Alarm']

For some reason Seleniumbase is not able to identify this custom XPATH and I tried similarly to use CSS but result is still the same.
Element is visible: span:contains('Alarm')
Element not visible: a[aria-expanded='false'], a:not([aria-expanded]) span:contains('Alarm')

This XPATH works fine when searching with Chrome Inspect and the code has ample wait for element to be visible. I also checked for opacity attribute and found no property for this element. The element is actually visible in the UI but not detected by SeleniumBase. And I have to use the custom xpath to find if the menu option is already expanded or not.

The html appears like this:

<li class="false" style="margin-bottom: 8px;">
  <a aria-expanded="false"><img src="data:image/svg"><span>Alarm</span></a>
</li>

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionSomeone is looking for answers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions