Represents the inline frame control (<iframe>). Default search finds the first occurring <iframe> element.

<div>
    <iframe src="...">
        <html>
            <body>
                <input type="text" id="text-box">
            </body>
        </html>
    </iframe>
</div>

Supports [GoTemporarily] settings attribute.

Frame<TOwner>

Recommended to use for the cases when the frame page can be different in parent page.

using Atata;
using _ = SampleApp.SamplePage;

namespace SampleApp
{
    public class SamplePage : Page<_>
    {
        public Frame<_> ContentFrame { get; private set; }
    }
}
using Atata;
using _ = SampleApp.FramePage;

namespace SampleApp
{
    public class FramePage : Page<_>
    {
        [FindById]
        public TextInput<_> TextBox { get; private set; }
    }
}
Go.To<SamplePage>().
    ContentFrame.SwitchTo<FramePage>(temporarily: true).
        TextBox.Set("abc").
        SwitchToRoot<SamplePage>().
    // Or use DoWithin method
    ContentFrame.DoWithin<FramePage>(
        x => x.TextBox.Should.Equal("abc"));

Methods

public virtual TFramePageObject

SwitchTo<TFramePageObject>(TFramePageObject framePageObject = null, bool? temporarily = null)

where TFramePageObject : PageObject<TFramePageObject>

Switches to the frame page object represented by the instance of TFramePageObject type. If temporarily is to true, navigates temporarily preserving current page object state. If temporarily is not set, checks GoTemporarilyAttribute.

public TOwner

DoWithin<TFramePageObject>(Action<TFramePageObject> action, bool? temporarily = null)

where TFramePageObject : PageObject<TFramePageObject>

Switches to the frame page object, executes action(s) in scope of frame and switches back to the owner page object. If temporarily is to true, navigates temporarily preserving current page object state. If temporarily is not set, checks GoTemporarilyAttribute.

Frame<TFramePageObject, TOwner>

Recommended to use for the cases when the frame page is the same in parent page.

using Atata;
using _ = SampleApp.SamplePage;

namespace SampleApp
{
    public class SamplePage : Page<_>
    {
        public Frame<FramePage, _> ContentFrame { get; private set; }
    }
}
using Atata;
using _ = SampleApp.FramePage;

namespace SampleApp
{
    public class FramePage : Page<_>
    {
        [FindById]
        public TextInput<_> TextBox { get; private set; }

        public SamplePage SwitchBack()
        {
            return SwitchToRoot<SamplePage>();
        }
    }
}
Go.To<SamplePage>().
    ContentFrame.SwitchTo().
        TextBox.Set("abc").
        SwitchBack().
    // Or use DoWithin method
    ContentFrame.DoWithin(
        x => x.TextBox.Should.Equal("abc"));

Methods

public TFramePageObject

SwitchTo(TFramePageObject framePageObject = null, bool? temporarily = null)

Switches to the frame page object represented by the instance of TFramePageObject type. If temporarily is to true, navigates temporarily preserving current page object state. If temporarily is not set, checks GoTemporarilyAttribute.

public TOwner

DoWithin(Action<TFramePageObject> action, bool? temporarily = null)

Switches to the frame page object, executes action(s) in scope of frame and switches back to the owner page object. If temporarily is to true, navigates temporarily preserving current page object state. If temporarily is not set, checks GoTemporarilyAttribute.