title: How to click on the aside / previous Table Cell (TD) in the same row using Selenium Webdriver with Java?
body: <p>I want to click on the Checkbox element which is present in the dynamic web table which has 3 static columns (CheckBox, Description, Link) and dynamic rows.</p>
  
  <p><a href="https://i.stack.imgur.com/o9i7u.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o9i7u.jpg" alt="Sample Image"></a> <br><br>
  I'm able to get the exact text of the description of the check box but I'm unable to click on the check box.</p>
  
  <p>Here's the script I tried to achieve my expectation but didn't work. Might be a wrong approach.</p>
  
  <pre><code>WebElement dataTable = driver.findElement(By.id("table_id"));
  List&lt;WebElement&gt; TDs = dataTable.findElements(By.tagName("td"));
  for(WebElement td : TDs)
  {
      if (!td.getText().trim().equals("text that i want to click on its checkbox"))
      continue;
  
      WebElement particularTd = td.findElement(By.xpath("//*[@type='checkbox']//preceding::input"));
      particularTd.click();
  }
  </code></pre>
  
  <p>Could you tell me the right way to click on the check box?</p>
  
  <p>Thanks,<br>
  Karunagara Pandi G</p>