WindowActions
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 ();
getScreenshot
â
This method will get the screenshot of the current page and return its Base64 encoded string.
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
. . .
System.out.println (onWindow ().getScreenshot ());
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");