I'm working in selenium with c#

Assert is not working though xpath is given correctly. xpath shows only one item. It was working correctly quite sometime back.

Here is my piece of code.

  Assert.IsTrue(_driver.FindElement(By.XPath("//div[@class='k-animation-container'][1]//*[@id='Id']/li[1]")).Text.Equals("accused stabbed"));

please find the image for your reference, same Id recurring more than 5 times. i I have informed the Dev. I hope this could be the reason Assert not working.

enter image description here

  • Please share more details, like the concrete error and the element text. Is the element text really like this, aren't there any white spaces for example? – puzzle Nov 18 at 9:28
  • What is the error? How does the HTML look like? Do you wait for another element on the page, how do you know the page is done rendering? You need to provide more details. – Niels van Reijmersdal Nov 18 at 10:35
  • BTW, since you have an ID, the .k-animation-container class is unnecessary and may be causing errors. – João Farias Nov 18 at 12:30
  • Kindly indicate screenshot for error – Georgie Nov 20 at 4:24
  • Hi all i have edited my questions, sorry for the late reply, i could see recurring Id for the same <ul> – Thiyagarajan Nov 20 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.