title: NoSuchElementException: Message: no such element: Unable to locate element when trying to find element within a iframe
body: <p>I am trying to automate a Google Chrome session in Python using Selenium. Until now, I have been using an extension to get the xpath, which works OK. But now, I encounter an error when using the xpath I have located:</p>
  <blockquote>
  <p>NoSuchElementException: Message: no such element: Unable to locate element: {&quot;method&quot;:&quot;xpath&quot;,&quot;selector&quot;:&quot;//*[@id=&quot;ok&quot;]&quot;}
  (Session info: chrome=71.0.3578.98)
  (Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387),platform=Windows NT 6.3.9600 x86_64)</p>
  </blockquote>
  <p>The line that returns an error looks like this:</p>
  <pre><code>browser.find_element_by_xpath('//*[@id=&quot;ok&quot;]').click()
  </code></pre>
  <p>Unfortunately, the button I need to click is pretty deep within a webpage and requires a certain plugin, which makes it hard for you to replicate the flow of my program. Therefore, I have uploaded an image of the source code of the webpage (The blue line is the button I would like to click):</p>
  <p><a href="https://i.stack.imgur.com/2gpC4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2gpC4.png" alt="enter image description here" /></a></p>
  <p>Could you provide some help on how to correct the selenium selector, so that I will be able to click the element?</p>