Search code examples
pythonseleniumxpathcss-selectorslinktext

Python Selenium - find item in a list


I have the following:

<a href="/firewall_aliases.php" class="navlnk">Aliases</a>
<a href="/firewall_aliases.php" class="navlnk">NAT</a>
<a href="/firewall_aliases.php" class="navlnk">Rules</a>

I can't seem to be able to locate the element with text Aliases. Is it possible to do?

Can anyone help me out?


Solution

  • You can use like:

    //*[text()="Aliases"]

    another way is

    //a[@href="/firewall_aliases.php" and (text()="Aliases")]