title: NoSuchElementError: no such element: Unable to locate element while trying to locate element through WebdriverJS
body: <p>I was using css to locate element, i was trying to avoid xpath just in case, but im having trouble with the element. Im still getting error: </p>
  
  <pre><code>(node:7516) UnhandledPromiseRejectionWarning: NoSuchElementError: no such element: Unable to locate element: {"method":"css selector","selector":"[name-firstName]"}
  </code></pre>
  
  <p>It only works on xpath, but i want to use css locator. Is it a good practice to avoid xpath when locating element? thank you guys!</p>
  
  <p>Here is the whole element: </p>
  
  <pre><code>&lt;input type="text" class="f w-input ng-pristine ng-invalid ng-invalid-required ng-touched" name="firstName" required="" ng-readonly="vm.showLoading" ng-model="vm.formData.firstName" placeholder="Your First Name"&gt;
  </code></pre>
  
  <p>Here is the code trial :</p>
  
  <pre><code>driver.get("www.examplewebsiteonly.com")
      .then(function() {
          return driver.wait(until.elementLocated(By.css('[name=firstName]')), 20000)
          .then(function(){
              driver.sleep(20000)
              .then(function(){
                          return driver.findElement(By.css('[name-firstName]')).sendKeys("FirstName");
                      })
          })
      })
  </code></pre>