Have you tried keeping the anchor text (good for accessibility) but hiding it:
<a class="btn btn-info" href="/users.php">
<i class="fa fa-users"></i> <span class="hidden">Users</span>
</a>
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to test some links without text and with some icon by codeception Webdriver module and phantomjs . the normal links with text found with:
$I->seeLink('users','/users.php');
how to test links with icons not text like this :
<a class="btn btn-info" href="/users.php">
<i class="fa fa-users"></i>
</a>
Maybe like this instead:
$I->seeElement('a', 'href' => '/users.php');
or even:
$I->seeElement('a .btn .btn-info', 'href' => '/users.php');
Sorry, untested, I'm not sure of the exact syntax but I'm sure you can look it up in the documentation :)
Please or to participate in this conversation.