Class BrowserSteps

java.lang.Object
com.shaft.cucumber.BrowserSteps

public class BrowserSteps extends Object
Cucumber step definitions for browser-level actions such as navigation, window management, and browser lifecycle operations.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new BrowserSteps instance, injecting a shared ThreadLocal WebDriver container from the Cucumber IoC context.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the current browser window
    void
    Switches the current browser window to full-screen mode.
    void
    Read the target browser value from the execution.properties file
    void
    Maximizes the current browser window to fill the screen.
    void
    Navigates one step back from the browsers history
    void
    Navigates one step forward from the browsers history
    void
    navigateToURL(String targetUrl)
    Navigates to targetUrl in case the current URL is different, else refreshes the current page
    void
    navigateToURL(String targetUrl, String targetUrlAfterRedirection)
    Navigates to targetUrl in case the current URL is different, else refreshes the current page.
    void
    Refreshes the currently loaded page in the browser.
    void
    setWindowSize(int width, int height)
    Resizes the current browser window to the specified dimensions.

    Methods inherited from class Object

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

    • BrowserSteps

      public BrowserSteps(ThreadLocal<SHAFT.GUI.WebDriver> driver)
      Constructs a new BrowserSteps instance, injecting a shared ThreadLocal WebDriver container from the Cucumber IoC context.
      Parameters:
      driver - a ThreadLocal wrapping a SHAFT.GUI.WebDriver instance; a new empty ThreadLocal is used if null is 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 pixels
      height - 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