title: How to take reCaptcha image in selenium C#
body: <p>When I try to get <code>reCaptcha v2</code> image in selenium, I get <code>no such this element</code> because the element not in the main page</p>
  
  <p>so how can I get the picture in selenium C#!</p>
  
  <pre><code>  _driver.Navigate().GoToUrl("https://www.google.com/recaptcha/api2/demo");
  
              _driver.SwitchTo().Frame(0);
  
              _driver.FindElement(By.Id("recaptcha-anchor")).Click();
  
  
  
              Thread.Sleep(5000);
  
              _driver.SwitchTo().Frame(0);
  
              //To get all images in page
              IList&lt;IWebElement&gt; images = _driver.FindElements(By.TagName("img"));
  
              MessageBox.Show(images.Count.ToString());
  
              string reCaptchaXpath = "";
  
              foreach (var img in images)
              {
                  if (img.GetAttribute("src").Contains("https://www.google.com/recaptcha/api2/"))
                  {
                      reCaptchaXpath = GenerateXpath(img, "");
                  }
              }
  </code></pre>