Static methods

onWindow

This will return IWindowActions which will expose different methods to handle windows related actions.
IWindowActions windowActions = WindowActions.onWindow ();

Instance methods

close

This method will close the open browser window.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
. . .
onWindow ().close ();

currentHandle

This method returns the current window handle.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
. . .
String handle = onWindow ().currentHandle ();

fullScreen

This method will on-demand do full screen on the browser window.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
. . .
onWindow ().fullScreen ();

maximize

This method will maximize the browser window.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
. . .
onWindow ().maximize ();

minimize

This method will minimize the browser window.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
. . .
onWindow ().minimize ();

switchToDefault

This method will switch to the first window after you close any of the other opened windows.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
. . .
onWindow ().switchToDefault ();

switchToNew

This method is used to switch to new window of given type.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
import org.openqa.selenium.WindowType;
. . .
onWindow ().switchToNew (WindowType.TAB);

switchTo (handle)

This method is used to switch to window of given handle.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
. . .
onWindow ().switchTo ("window-handle");

takeScreenshot

This method will take the screenshot of the current page and save it at the path configured in boyka-config.json.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
. . .
onWindow ().takeScreenshot ();

takeScreenshot (path)

This method will take the screenshot of the current page and save it at the path mentioned in the parameter.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
. . .
onWindow ().takeScreenshot ("path/to/screenshot.png");

title

This method will get the title of the browser window.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
. . .
System.out.println (onWindow ().getTitle ());

viewportSize

This method will the size dimension of the screen viewport for Mobile screen or Browser window.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
import org.openqa.selenium.Dimension;
. . .
Dimension size = onWindow ().viewportSize ();

handles

This method will get the list of all open window handles.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
. . .
List<String> handles = onWindow ().handles ();

verifyBrowserTitle

This method is used to verify the browser title.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
. . .
onWindow ().verifyTitle (title).isEqualTo ("Swag Labs");