title: How to send text to the username field using Selenium and Java
body: <p>I am trying to send information to a textfield and I am having difficulties locating it. There are multiple elements with the same name and it's difficult to find it.</p>
  <pre><code>&lt;div class=&quot;form-group&quot;&gt;
    &lt;label for=&quot;username&quot;&gt;LDAPTEST Username&lt;/label&gt;
    &lt;input type=&quot;text&quot; name=&quot;username&quot; id=&quot;username&quot; class=&quot;form-control top&quot; title=&quot;This field is required.&quot; autofocus=&quot;autofocus&quot; data-qa-selector=&quot;username_field&quot; required=&quot;required&quot;&gt;
    &lt;p class=&quot;gl-field-error hidden&quot;&gt;This field is required.&lt;/p&gt; 
  &lt;/div&gt;
  </code></pre>
  <p>I have tried the following:</p>
  <pre><code>username_By = By.id(&quot;username&quot;)
  
  username_By = By.cssSelector(&quot;input[data-qa-selector='username_field']&quot;)
  </code></pre>
  <p>I am getting TimeoutException when I am waiting for the visibility of the element.</p>
  <pre><code>wait.until(ExpectedConditions.visibilityOfElementLocated(username_By));
  </code></pre>
  <p>Any suggestions on how to locate the element? Thanks</p>