title: How to find element's xpath in chrome for selenium testing
body: <p>When I inspected my page in chrome, I get this:</p>
  
  <pre><code>&lt;input class="form-control form-text required" title="" data-toggle="tooltip" type="text" id="edit-name" name="name" value="" size="60" maxlength="60" data-original-title="Enter your username."&gt;
  </code></pre>
  
  <h1>1.</h1>
  
  <p>I right clicked on this code and selected Copy > Xpath. I got this:</p>
  
  <pre><code>//*[@id="edit-name"]
  </code></pre>
  
  <p>I created a variable:</p>
  
  <pre><code>final By userNameField = By.xpath ("//*[@id="edit-name"]");
  </code></pre>
  
  <p>I get syntax error.</p>
  
  <h1>2.</h1>
  
  <p>Then I tried this by id</p>
  
  <pre><code>public void enterUserName(){
  driver.findElement(By.id("edit-name")).sendKeys("admin"); 
  System.out.println("User name is entered");
  }
  </code></pre>
  
  <p>It entered the user name just fine. How do I find the correct xpath in chrome so I can create a variable like I tried in step 1?</p>