title: Selenium webdriver convert CSS selector to XPath
body: <p>This is for Selenium webdriver xPath. Please refer to screen capture. I am writing following XPath for Collection #1 button, but this is just temporary text which has been given to button. but this text will be change once BLL is implemented. So how do I define XPath? In screen capture UI and HTML is there.</p>
  
  <p>For now I gave following xpath in my script.</p>
  
  <pre><code>//*[@class='infix' and text()='Collection #1']
  </code></pre>
  
  <p>This is xPath</p>
  
  <pre><code>/html/body/esx-root/div/esx-prospect-landing/esx-community-search-hero/div[2]/div[2]/div/button[1]
  </code></pre>
  
  <p><strong>This is CSS</strong></p>
  
  <pre><code>html body esx-root div.container esx-prospect-landing.ng-star-inserted esx-community-search-hero div.content-wrapper div.bottom-wrapper div.hero-actions button span.infix
  </code></pre>
  
  <p><strong>This is CSS Selector</strong> </p>
  
  <pre><code>.hero-actions &gt; button:nth-child(1) &gt; span:nth-child(2)
  </code></pre>
  
  <p>How do I define short way XPath in my script. </p>
  
  <p><img src="https://i.stack.imgur.com/8sOY5.png" alt="enter image description here"></p>