I had been having a problem trying to select an item in a dropdown. I have checked resources online but I still couldn't get it working. My HTML is this:
<div id="dropdownID">
<ul class="ulList">
<li class="liItem"> Number 1 </li>
<li class="liItem"> Number 2 </li>
</ul>
</div>
while my selenium C# is:
var drop = Driver.FindElement(By.Id("dropdownId")).FindElement(By.Xpath("//ul/li[(@class='liItem') and contains(text(),'{0}')]")).click();
drop.SendKeys(value);
Where {value} is a string that I would like to input on sendkeys. The error would be:
no such element: Unable to locate element: {"method":"xpath","selector":"//ul/li[(@class='liItem') and contains(text(),'{0}')]"}