Class Switch

java.lang.Object
net.serenitybdd.screenplay.actions.Switch

public class Switch extends Object
Switch to a different frame or window. This wraps the WebDriver.switchTo() methods as Screenplay interactions.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.serenitybdd.screenplay.Performable
    Switches to the element that currently has focus within the document currently "switched to", or the body element if this cannot be detected.
    Switch focus to an HTML alert window
    static net.serenitybdd.screenplay.Performable
    Selects either the first frame on the page, or the main document when a page contains iframes.
    static net.serenitybdd.screenplay.Performable
    toFrame(Integer frameId)
     
    static net.serenitybdd.screenplay.Performable
    toFrame(String frameName)
     
    static net.serenitybdd.screenplay.Performable
    toFrame(org.openqa.selenium.WebElement webElement)
     
    static net.serenitybdd.screenplay.Performable
     
    static net.serenitybdd.screenplay.Performable
    toNewWindow(org.openqa.selenium.WindowType windowType)
    Switch to a window of a specified type (WINDOW or TAB)
    static net.serenitybdd.screenplay.Performable
     
    static net.serenitybdd.screenplay.Performable
    Switch to the first window that is not the current window.
    static net.serenitybdd.screenplay.Performable
    toWindow(String nameOrHandle)
     
    static net.serenitybdd.screenplay.Performable
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Switch

      public Switch()
  • Method Details

    • toFrame

      public static net.serenitybdd.screenplay.Performable toFrame(Integer frameId)
    • 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

      public static net.serenitybdd.screenplay.Performable toFrame(String frameName)
    • toFrame

      public static net.serenitybdd.screenplay.Performable toFrame(org.openqa.selenium.WebElement webElement)
    • toParentFrame

      public static net.serenitybdd.screenplay.Performable toParentFrame()
    • toWindow

      public static net.serenitybdd.screenplay.Performable toWindow(String nameOrHandle)
    • toNewWindow

      public static net.serenitybdd.screenplay.Performable toNewWindow()
    • toWindowTitled

      public static net.serenitybdd.screenplay.Performable toWindowTitled(String title)
    • toTheOtherWindow

      public static net.serenitybdd.screenplay.Performable toTheOtherWindow()
      Switch to the first window that is not the current window.
      Returns:
    • toAlert

      public static AlertAction 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: