title: Reach for the deep nested element using Selenium WebDriver (Java)
body: <p>I looked through a lot of topics on Stackoverflow and tried several recommendations but could hardly succeed in resolving my particular case. I'm trying to automate <a href="https://cloud.google.com/products/calculator" rel="nofollow noreferrer">Google Cloud Pricing Calculator</a> using Selenium WebDriver + Java. I need insert the Number of instances (the first input area on the page) using Java code.</p>
  <p>My Java code is following:</p>
  <pre><code>WebDriver driver = new ChromeDriver();
      driver.get(&quot;https://cloud.google.com/products/calculator&quot;);
  
      new WebDriverWait(driver, 10)
              .until(ExpectedConditions.presenceOfElementLocated(By.xpath(&quot;//iframe[contains (@name, 'goog_')]&quot;)));
  
      WebElement document = driver.findElement(By.xpath(&quot;//iframe[contains (@name, 'goog_')]&quot;));
      var iframe = document.findElement(By.xpath(&quot;//iframe[@id='myFrame']&quot;));
      var input = iframe.findElement(By.xpath(&quot;//input[@id='input_66']&quot;));
      input.click();
      input.sendKeys(&quot;4&quot;);
  </code></pre>
  <p>But NoSuchElementException is thrown when I launch the code: &quot;no such element: Unable to locate element: {&quot;method&quot;:&quot;xpath&quot;,&quot;selector&quot;:&quot;//iframe[@id='myFrame']&quot;}.</p>
  <p><code>Xpath</code> is correct but this element is hidden deep into <code>html</code> tree. How can I reach for the element (Number of instances) in this particular case? Thank you in advance!</p>