title: How can I check if element is present in laravel dusk test?
body: <p>In the below code, I want to check if the element is present at XPath, then only it should execute code.</p>
  
  <pre><code>if($browser-&gt;driver-&gt;findElement(WebDriverBy::xpath('/html/body/div[1]/div/section/div[3]/div[2]/div/table/tbody/tr['.$i.']/td[2]'))!==null) 
  { 
      $sort=$browser-&gt;driver-&gt;findElement(WebDriverBy::xpath('/html/body/div[1]/div/section/div[3]/div22]/div/table/tbody/tr['.$i.']/td[2]'))-&gt;gettext();
  echo $sort; 
  }
  </code></pre>
  
  <p>Or else please suggest if there is another way to check element is present  in laravel dusk.
  P.S. I tried whenAvailable method but it couldn't help me in this case.</p>