Question: This is my sample html code. 

```
<div class="content">
<M class="mclass">
   <section id="sideA">
       <div id="mainContent"> 
           <div class="requestClass"> 
              <span>Check</span>
              <input type="text" id="box">
           </div>
       </div>
   <section>
   <section id="sideB">
      ...
   <section>
</M>
</div>

```

I want to set some value to my text field ("box"). So I tired to set like below code 

```
driver.findElement(By.xpath("...")).sendKeys("SetValue");

```

My Xpath id is correct, it's exist in the page but am getting this error

```
no such element: Unable to locate element: {"method":"xpath","selector":"id("..."}

```

Why I am getting this error because of my custom tag,if yes how to get element inside custom tag?

Answer: 
As per the `HTML` you have provided to fill in some value to the text field represented by `<input type="text" id="box">` you can use either of the following line of code:

1. `cssSelector` :

```
driver.findElement(By.cssSelector("section#sideA input#box")).sendKeys("SetValue");

```
2. `xpath` :

```
driver.findElement(By.xpath("//section[@id='sideA']//input[@id='box']")).sendKeys("SetValue");

```
You can use `ID` or `xpath` to locate it, My suggestion you have to use `ID`. Also use Explicit wait till element to be visible.

Using `ID`, your code is like this:

```
WebElement elem= driver.findElement(By.id("box"));
WebDriverWait wait=new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOf(elem));
elem.sendKeys("test");

```

You can also use `JavascriptExecutor` 

```
WebElement elem= driver.findElement(By.id("box"));
WebDriverWait wait=new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOf(elem));
JavascriptExecutor myExecutor = ((JavascriptExecutor) driver);
myExecutor.executeScript("arguments[0].value='test';", elem);

```