0

Have following source on the webpage , what I want is to click on the button which is under class fa fa-repeat. Tried to use xpath = "//*[@id=\"accountsList\"//following-sibling::i[@class='fa fa-repeat']" but it doesn't work. Could anyone help/explain me why ? And what could be the best alternative to locate such elements (not necessary via xpath, could be css selector as well) ...

My HTML code is as below:

<li class="list-group-item">
    <div class="row account-item">
        <div class="col-xs-10">
            <span class="label label-danger account-status">O<br>F<br>F</span>
            <div><b>assssss</b></div>
            <div>company</div>
        </div>
        <div class="col-xs-2 text-right">
            <i data-account="ababa" class="fa fa-repeat"></i>
            <i class="account-options fa fa-ellipsis-v" data-toggle="dropdown"></i>
            <ul class="dropdown-menu" role="menu">
                <li>
                    <a data-account="fds" class="account-option toggle-active">
                        <i class="fa fa-play"></i> Start </a>
                </li>
            </ul>
        </div>
    </div>
</li>
2
  • The updated HTML doesn't have element with id accountsList... Commented Sep 14, 2015 at 9:49
  • When you post HTML please take a minute to use a beautifier like jsbeautifier.org to properly format it. It makes it a LOT easier to read which makes your question more likely to get answered. Thanks! Commented Sep 14, 2015 at 15:21

1 Answer 1

1

The target i element is not sibling of *[@id='accountsList'] but descendant :

//*[@id='accountsList']//i[@class='fa fa-repeat']

or using more specific path :

//*[@id='accountsList']/div/div/i[@class='fa fa-repeat']
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.