Selenium IDE: search for a specific text and press the button

advertisements

I have a list of li's within an ul, where the li would look like:

<li class="list-group-item operator">
            <div class="pull-right">
                <a href="/index.php?page=excursion_transport&amp;sub_page=operators&amp;mode=edit&amp;id=10" class="tooltip-hook" title="" data-original-title="Rediger operatøren">
                    <span class="fa fa-pencil fa-fw"></span>
                </a>
                <span class="text-muted tooltip-hook" title="" data-original-title="Operatøren kan ikke slettes da den har transportmidler.">
                    <span class="fa fa-trash fa-fw"></span>
                </span>
            </div>
            <a href="/index.php?page=excursion_transport&amp;sub_page=operators&amp;mode=edit&amp;id=10">Ice Cap Tours</a>
        </li>

How do I with Selenium IDE find the text "Ice Cap Tours" and at the same time press the pencil that are present in the "span class='fa-pencil'"?


If you're looking to interact with them you'd need the following locators

//a[contains(text(),'Ice Cap Tours')]//..

//span[contains(@class, 'fa-pencil')]

The first will just look for the span containing the text you're after, and the "//.." navigates up to the parent element (the a tag) to click on the link

The second one will look for the span whos class contains "fa-pencil", you may have had trouble with the other suggested locators as they will have been looking for an exact match of the class, rather than just a class which contains that one