I'm trying to figure it out too. I have not decided this yet, but here is a rough draft of my concept. It seems like this will work, but it is not (I am getting an outdated reference exception). I just need to figure out how this works:
public boolean clickByLinkTextInsensitive( String matcher ) { List<WebElement> els = driver.getElements( By.xpath( ".//a[@href!='']" ) ); for ( WebElement el: els ) { if ( els.getText().toLowerCase().equals( matcher.toLowerCase() ) ) { el.click(); } } }
source share