I have and html element that I wish to click using Selenium:
<a class="epi-navigation-global_user_settings_shell_search " href="DatabaseJob.aspx?pluginId=20">
Importer obligationsliste
</a>
With the following xpath: /html/body/form/div[4]/div[1]/div/ul/li[2]/ul/li[19]/a
I attempt to click the element containing the text "Importer obligationsliste"
by the following expression:
var obligationButton = By.XPath("//a[contains(text(), 'Importer')]");
wait.Until(ExpectedConditions.ElementToBeClickable(obligationButton)).Click();
Yet the element is never found. I've also tried the full string Importer obligationsliste
to no avail.
Any ideas why the element is not being found? I suspect it has to do with the whitespace around the text, but contains()
should also be able to find substrings.