當我嘗試在硒中獲得reCaptcha v2圖像時,我沒有這樣的元素! Becoz的元素不在主頁面如何在硒中使用reCaptcha圖像#
所以我怎麼能得到硒在C#中的圖片!
_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<IWebElement> 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, "");
}
}
請說明您的具體問題或添加額外的細節,突顯正是你需要的。正如目前所寫,很難確切地說出你在問什麼。請參閱[問]頁面以獲得澄清此問題的幫助。 – JeffC