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");
  • 2
    Which language are you using? And can you show relevant html too? – Rao Jun 18 '16 at 4:30
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, privacy policy and cookie policy

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