iOS - How to access elements within IFrame?

Currently there’s a issue with Appium on iOS/Safari, where you’re unable to switch to an IFrame using:

driver.SwitchTo().Frame("siteFrame");

If I try to switch to the IFrame, and then view the page source, I’m given the page source for the parent document. If I then try to find an element within the IFrame, I get a NoSuchElementException. I’ve tried a number of ways, including trying to find the IFrame element via JS, however I haven’t had any luck.

I’m not seeing an issue on Android, so I’m wondering if anyone got a solution that will allow me to find elements within an IFrame on iOS?

If you want any code examples, please let me know!

Cheers!

Hi, Siggerzz
Do you get any progress for this issue. if there any solution, please share here, thanks in advance!

Hey this should be fixed now!

There is an issue however when clicking elements within an IFrame.

To get around this, rather than using the .click() method, I created a new method to click an element using it’s coordinates, which seems to work.

protected void ClickElementByCoordinates(IWebDriver driver, IWebElement element)
{
    _driver = driver;
    _wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(10));
    _wait.Until(ExpectedConditions.ElementToBeClickable(element));

        var x = element.Location.X;
        var y = element.Location.Y;

        _jsDriver = _driver as IJavaScriptExecutor;

    if (_jsDriver != null)
    { 
        _jsDriver.ExecuteScript("document.elementFromPoint(arguments[0],arguments[1]).click();", x, y);
    }
}

My example is in C#, however if you’re using another language, you should be able to achieve the same!

Hi everyone,
Have you got any solution for this issue? I am facing with same issue :frowning: