title: How to create my own xpath on website- Selenium
body: <p>I'm writing a small application to go on to twitter.com select the login button and then enter username and password.</p>
  <p>I've been able to inspect the log in button and copy the XPath from chrome but I've been unsuccessful in create my own XPath from the information given. The XPath used when copied does work but it doesn't look tidy in my code therefore I'm keen to write my own.</p>
  <pre><code>WebDriver driver = new ChromeDriver();
  driver.get(&quot;http://www.twitter.com&quot;);
  driver.findElement(By.xpath(&quot;//*[@id=\&quot;react-root\&quot;]/div/div/div/main/div/div/div[1]/div[1]/div/div[3]/a[2]/div&quot;)).click();
  </code></pre>
  <p>Below is what is given when I inspect the log in button.</p>
  <pre><code>&lt;div dir=&quot;auto&quot; class=&quot;css-901oao r-1awozwy r-13gxpu9 r-6koalj r-18u37iz r-16y2uox r-1qd0xha r-a023e6 r-b88u0q r-1777fci r-ad9z0x r-dnmrzs r-bcqeeo r-q4m81j r-qvutc0&quot;&gt;
      &lt;span class=&quot;css-901oao css-16my406 css-bfa6kz r-poiln3 r-bcqeeo r-qvutc0&quot;&gt;
          &lt;span class=&quot;css-901oao css-16my406 r-poiln3 r-bcqeeo r-qvutc0&quot;&gt;Log in&lt;/span&gt;
      &lt;/span&gt;
  &lt;/div&gt;
  </code></pre>