New answers tagged xpath
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");
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
A common reason for finding something in the seleniumIDE but not programmatically using webDriver is when there are multiple instances. The IDE selects the first automatically but programmaticaly you need to use  at the end of the element, e.g. div
My main criteria is readability and maintainability. Speed has never been as issue for me. There's other parts of the test frameworks I use that have much more significant speed issues. The basic idea is always 'what will it take to uniquely identify the element' with two principles: Don't over specify the page structure - this will make the selector ...
It depends on by which locator your element get located, but you should always follow the order following is top priority(fast) to low priority(slow) locator. ID Name Link text Partial link text Tag name Class name CSS Xpath
First try with the properties Id,Name. If the objects are not having the unique properties then go for XPATH.
Top 50 recent answers are included