Class BrowserSteps
java.lang.Object
com.shaft.cucumber.BrowserSteps
Cucumber step definitions for browser-level actions such as navigation, window management,
and browser lifecycle operations.
-
Constructor Summary
ConstructorsConstructorDescriptionBrowserSteps(ThreadLocal<SHAFT.GUI.WebDriver> driver) Constructs a newBrowserStepsinstance, injecting a sharedThreadLocalWebDriver container from the Cucumber IoC context. -
Method Summary
Modifier and TypeMethodDescriptionvoidCloses the current browser windowvoidSwitches the current browser window to full-screen mode.voidRead the target browser value from the execution.properties filevoidMaximizes the current browser window to fill the screen.voidNavigates one step back from the browsers historyvoidNavigates one step forward from the browsers historyvoidnavigateToURL(String targetUrl) Navigates to targetUrl in case the current URL is different, else refreshes the current pagevoidnavigateToURL(String targetUrl, String targetUrlAfterRedirection) Navigates to targetUrl in case the current URL is different, else refreshes the current page.voidRefreshes the currently loaded page in the browser.voidsetWindowSize(int width, int height) Resizes the current browser window to the specified dimensions.
-
Constructor Details
-
BrowserSteps
Constructs a newBrowserStepsinstance, injecting a sharedThreadLocalWebDriver container from the Cucumber IoC context.- Parameters:
driver- aThreadLocalwrapping aSHAFT.GUI.WebDriverinstance; a new emptyThreadLocalis used ifnullis supplied
-
-
Method Details
-
getBrowser
@Given("I Open the target browser") public void getBrowser()Read the target browser value from the execution.properties file -
maximizeWindow
@When("I Maximize the current window") public void maximizeWindow()Maximizes the current browser window to fill the screen. -
setWindowSize
@When("I Resize the current window size to {int} width * {int} height") public void setWindowSize(int width, int height) Resizes the current browser window to the specified dimensions.- Parameters:
width- the desired window width in pixelsheight- the desired window height in pixels
-
fullScreenWindow
@When("I Full Screen the current window") public void fullScreenWindow()Switches the current browser window to full-screen mode. -
refreshCurrentPage
@When("I Refresh the current window") public void refreshCurrentPage()Refreshes the currently loaded page in the browser. -
closeCurrentWindow
@When("I Close the current window") public void closeCurrentWindow()Closes the current browser window
-