Class Switch
java.lang.Object
net.serenitybdd.screenplay.actions.Switch
Switch to a different frame or window.
This wraps the WebDriver.switchTo() methods as Screenplay interactions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.serenitybdd.screenplay.PerformableSwitches to the element that currently has focus within the document currently "switched to", or the body element if this cannot be detected.static AlertActiontoAlert()Switch focus to an HTML alert windowstatic net.serenitybdd.screenplay.PerformableSelects either the first frame on the page, or the main document when a page contains iframes.static net.serenitybdd.screenplay.Performablestatic net.serenitybdd.screenplay.Performablestatic net.serenitybdd.screenplay.PerformabletoFrame(org.openqa.selenium.WebElement webElement) static net.serenitybdd.screenplay.Performablestatic net.serenitybdd.screenplay.PerformabletoNewWindow(org.openqa.selenium.WindowType windowType) Switch to a window of a specified type (WINDOW or TAB)static net.serenitybdd.screenplay.Performablestatic net.serenitybdd.screenplay.PerformableSwitch to the first window that is not the current window.static net.serenitybdd.screenplay.Performablestatic net.serenitybdd.screenplay.PerformabletoWindowTitled(String title)
-
Constructor Details
-
Switch
public Switch()
-
-
Method Details
-
toFrame
-
toNewWindow
public static net.serenitybdd.screenplay.Performable toNewWindow(org.openqa.selenium.WindowType windowType) Switch to a window of a specified type (WINDOW or TAB) -
toFrame
-
toFrame
public static net.serenitybdd.screenplay.Performable toFrame(org.openqa.selenium.WebElement webElement) -
toParentFrame
public static net.serenitybdd.screenplay.Performable toParentFrame() -
toWindow
-
toNewWindow
public static net.serenitybdd.screenplay.Performable toNewWindow() -
toWindowTitled
-
toTheOtherWindow
public static net.serenitybdd.screenplay.Performable toTheOtherWindow()Switch to the first window that is not the current window.- Returns:
-
toAlert
Switch focus to an HTML alert window -
toDefaultContext
public static net.serenitybdd.screenplay.Performable toDefaultContext()Selects either the first frame on the page, or the main document when a page contains iframes.- Returns:
-
toActiveElement
public static net.serenitybdd.screenplay.Performable toActiveElement()Switches to the element that currently has focus within the document currently "switched to", or the body element if this cannot be detected. This matches the semantics of calling "document.activeElement" in Javascript.- Returns:
-