0

When I attempt to search for the following element by XPath, Selenium does not find the the element. Not sure what I'm missing here.

driver.FindElement(By.XPath("//input[@type='text']")).SendKeys("Test");
1
  • 2
    Which language are you using? And can you show relevant html too?
    – Rao
    Jun 18, 2016 at 4:30

2 Answers 2

2

May be because there are many elements on the page with same xpath. check if you have more than one input type text element present on the screen.

install plugin firepath on mozilla then paste your xpath over there it will highlight the elements ,if it highlights more than one element then you need to change the xpath

0

It seems that there are more than element in the page source. I suggest you to use xpath with id of the element.It seems like that

driver.FindElement(By.XPath("//input[@id='idofelement']")).SendKeys("Test");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.