XPATH required for an input text field?


i have a text box in my web application,Where i need to give input. I am trying to find the xpath of the text box. the following error is thrown.


Unable to locate element: {"method":"xpath","selector":"


HTML code:

<div class="input"> <input id="firstName" class="long" type="text" maxlength="50" value="" name="firstName

I want the xpath for firstName textbox.


Try this one:



<ul><li>// search on all levels</li> <li>input for element nodes with the name of "input"</li> <li>[@id='firstName'] having an attribute (@) with the name of "id" and a value of "firstName"</li> </ul>



And this for generally targeting a text input (what I was after)


at least 3 simple ways to get this:

1)Driver.FindElement(By.XPath("//input[@id='firstName']")); 2)Driver.FindElement(By.Id("firstName")); 3)Driver.FindElement(By.CssSelector("#firstName"));



finding by text would always work.


  • maven-cobertura-plugion does not show the sources [closed]
  • How do I get rid of the Eclipse Find/Replace Bar
  • How to replace TouchesBegan with UIGestureRecognizer
  • how to remove a div with same ids but display='block' and display='none' in JAVa
  • Titanium doesn't recognize Android SDK on Windows
  • How to move an element within a structure, possibly with zippers?
  • Jquery popup on mouse over of calendar control
  • C: Incompatible pointer type initializing
  • why xml file does not aligned properly after append the string in beginning and end of the file usin
  • Trying to switch camera back to front but getting exception
  • Weird JavaScript statement, what does it mean?
  • Cannot Parse HTML Data Using Android / JSOUP
  • How to get icons for entities from eclipse?
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • Acquiring multiple attributes from .xml file in c#
  • Free memory of cv::Mat loaded using FileStorage API
  • Angular 2 constructor injection vs direct access
  • Trying to get generic when generic is not available
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Java static initializers and reflection
  • embed rChart in Markdown
  • How to stop GridView from loading again when I press back button?
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • How can I remove ASP.NET Designer.cs files?
  • unknown Exception android
  • JaxB to read class hierarchy
  • Django query for large number of relationships
  • Programmatically clearing map cache
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Unable to use reactive element in my shiny app
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal