0

I have a site that embeds an iFrame with a sage Pay credit card section. I am not able to see anything within the iframe via Selenium. I have tried switching to the actual iframe (using index, web element and name) and then even trying to navigate to its iframe, but I am simply not able to see any of the html within the iframe itself using Selenium. I can see it within devTools. I assume Selenium cannot see it because it is secure? How can I get to the contents of this iframe?

Here is what i have tried getContext().getDriver().switchTo().frame(getContext().getDriver().findElements(By.xpath("//iframe[@class='and-card-iframe']")).get(0)).findElements(By.xpath("//input"))

credit card

  • btw, i have already tried the solution in https://stackoverflow.com/questions/54030701/unable-to-locate-element-of-credit-card-number-using-selenium-python and that didn't help – Troy B. Stauffer May 22 '20 at 12:25
  • Just in case anyone has the same issue, i found a solution. AjaxElementLocatorFactory ajaxElementLocatorFactory = new AjaxElementLocatorFactory(webDriver, 60); PageFactory.initElements(ajaxElementLocatorFactory, this); Once this is done, you then can switch to the IFrame and then everything works – Troy B. Stauffer Jul 23 '20 at 12:33

0 Answers0