I have the following HTML
<label class="ms-Label headerText-269" title="Reference Id">Reference Id</label>
which I am trying to locate using XPath. I have written the following which doesn’t seem to work.
driver.FindElement(By.XPath("//title[contains(text(),'Reference Id']"));
Any help would be appreciated.
Thanks
>Solution :
Try the below
driver.FindElement(By.XPath("//label[contains(text(),'Reference Id']"));
OR
driver.FindElement(By.XPath("//*[normalize-space()='Reference Id']"));