title: Can't find element with Xpath (Selenium with Jest)
body: <p>I just trying test a website with selenium and jest. But when i use <code> driver.findElement(By.xpath())</code> the method can't find element. And issued an error like this</p>
  <pre><code> NoSuchElementError: no such element: Unable to locate element: {&quot;method&quot;:&quot;xpath&quot;,&quot;selector&quot;:&quot;//*[@id=&quot;root&quot;]/div[2]/button[2]&quot;}   
        (Session info: chrome=84.0.4147.89)
  
        31 | 
        32 |         await driver.findElement(By.xpath(`//*[@id=&quot;root&quot;]/div[1]/ul[2]/li[2]/button`)).click();
      &gt; 33 |         await driver.findElement(By.xpath(`//*[@id=&quot;root&quot;]/div[2]/button[2]`)).click();
  </code></pre>
  <p>And here my code</p>
  <pre><code>const webdriver = require('selenium-webdriver');
  const {By, until, Navigation, Builder} = require('selenium-webdriver');
  const chromedriver = require('chromedriver');
  const chrome = require ('selenium-webdriver/chrome');
  const assert = require('assert');
  
  describe('Test Login with Jest', function() {
  
      let driver;
      jest.setTimeout(30000);
      beforeAll(async () =&gt; {
          chrome.setDefaultService(new chrome.ServiceBuilder(chromedriver.path).build());
          driver = await new Builder().withCapabilities(webdriver.Capabilities.chrome()).build();
  
      });
  
      afterAll(async () =&gt; {
          await driver.quit();
      });
  
      it(&quot;SEMANGAT GUH !&quot;, async () =&gt; {
          await driver.get(&quot;https://genflix.co.id&quot;);
  
          let titleGenflix = await driver.getTitle();
  
          await driver.findElement(By.xpath(`//*[@id=&quot;root&quot;]/div[1]/ul[2]/li[2]/button`)).click();
          await driver.findElement(By.xpath(`//*[@id=&quot;root&quot;]/div[2]/button[2]`)).click();
          await driver.findElement(By.xpath(`//*[@id=&quot;email&quot;]`)).sendKeys(&quot;my_email&quot;);
          await driver.findElement(By.xpath(`//*[@id=&quot;password&quot;]`)).sendKeys(&quot;my_password&quot;);
          await driver.findElement(By.xpath(`/html/body/div[1]/div[2]/form/button`)).click();
  
          assert.equal(titleGenflix, &quot;Genflix&quot;);
  
  
      }, 10000);
  });
  
  </code></pre>
  <p>I hope someone can help me,
  Thank you</p>