Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VerticalNavigation select() method needs strange initialization to function #65

Open
dsesami opened this issue Jul 18, 2018 · 2 comments

Comments

@dsesami
Copy link
Contributor

dsesami commented Jul 18, 2018

I have the following HTML which describes a patternfly vertical navigation:

<div class="nav-pf-vertical nav-pf-vertical-with-sub-menus">
    <ul class="list-group">
        <li class="active list-group-item"><a href="#"><span title="Foo"></span><span class="list-group-item-value">Foo</span></a></li>
        <li class="list-group-item"><a href="#"><span title="Bar"></span><span class="list-group-item-value">Bar</span></a></li>
        <li class="list-group-item"><a href="#"><span title="Credentials"></span><span class="list-group-item-value">Baz</span></a></li>
</div>

If I try to initialize the VerticalNavigation with a CSS locator like this:
nav = VerticalNavigation(locator=(Locator(css='.nav-pf-vertical')))

Then the function nav.select('Bar') does not work, and it cannot find the element to select it. It then returns the following error:

selenium.common.exceptions.NoSuchElementException: 
Message: Could not find an element './ul/li/a[span[normalize-space(.)="Bar"] or @href="Bar"]'

The above error implies that it is starting from the top div nav-pf-vertical, but it is not when searching the ./ul/li/a/span path. Rather, the select() function works properly when I initialize the VerticalNavigation with the HTML tag directly below, of the list-group class in the ul tag:
nav = VerticalNavigation(locator=(Locator(css='.list-group')))

The select() function then behaves normally. I believe that either the function needs to be refactored to only search starting from the parent of the <ul> tag, or the search needs to check for both possibilities.

@omaciel
Copy link

omaciel commented Jul 18, 2018

@psav can we get someone to look into this for us?

@psav
Copy link
Member

psav commented Jul 18, 2018

Will see what we can do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants