Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SwitchToFrame and SwitchToRoot methods to PageObject`1 #20

Closed
YevgeniyShunevych opened this issue Apr 28, 2017 · 0 comments
Closed
Assignees
Labels
Milestone

Comments

@YevgeniyShunevych
Copy link
Member

YevgeniyShunevych commented Apr 28, 2017

Support the following iframe switch functionality.

Direct/In-test

Go.To<RegularPage>().
    SwitchToFrame<FramePage>(By.Id("iframe-id")).
        TextBox.Set("abc").
        SwitchToRoot<RegularPage>().
    DoOtherStuff();

Within page objects

public class RegularPage : Page<_>
{
    // Some regular page properties.

    public FramePage SwitchToFrame()
    {
        return SwitchToFrame<FramePage>(By.Id("iframe-id"));
    }
}
public class FramePage : Page<_>
{
    // Some frame page properties.

    public RegularPage SwitchBack()
    {
        return SwitchToRoot<RegularPage>();
    }
}
Go.To<RegularPage>().
    SwitchToFrame().
        TextBox.Set("abc").
        SwitchBack().
    DoOtherStuff();    

Other

Pass an instance of the page object

SwitchToFrame(By.Id("iframe-id"), new FramePage(someArg))
SwitchToRoot(new RegularPage(someArg))

Temporarily navigation

SwitchToFrame<FramePage>(By.Id("iframe-id"), temporarily: true)
SwitchToFrame(By.Id("iframe-id"), new FramePage(someArg), temporarily: true)

Pass an instance of IWebElement:

IWebElement frame = Driver.Get(By.Id("iframe-id"));
SwitchToFrame<FramePage>(frame)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant