Class DriverFactoryHelper
java.lang.Object
com.shaft.driver.internal.DriverFactory.DriverFactoryHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcloseDriver(org.openqa.selenium.WebDriver driver) Closes the given WebDriver session and performs all associated teardown tasks: attaches video recording (if scope is DriverSession), collects WebDriver logs, handles dockerized driver cleanup, and removes the WebDriverManager reference.voidvoidinitializeDriver(@NonNull DriverFactory.DriverType driverType) voidinitializeDriver(@NonNull DriverFactory.DriverType driverType, org.openqa.selenium.MutableCapabilities customDriverOptions) voidinitializeDriver(@NonNull org.openqa.selenium.WebDriver driver) voidinitializeDriver(org.openqa.selenium.MutableCapabilities customDriverOptions) static voidstatic booleanChecks to see if the execution is a mobile-native executionstatic booleanChecks to see if the execution is a mobile-web executionstatic booleanChecks to see if the execution is a web-based execution
-
Constructor Details
-
DriverFactoryHelper
public DriverFactoryHelper() -
DriverFactoryHelper
public DriverFactoryHelper(org.openqa.selenium.WebDriver driver)
-
-
Method Details
-
isMobileNativeExecution
public static boolean isMobileNativeExecution()Checks to see if the execution is a mobile-native execution- Returns:
- true if it's a mobile mobile-native execution
-
isMobileWebExecution
public static boolean isMobileWebExecution()Checks to see if the execution is a mobile-web execution- Returns:
- true if it's a mobile mobile-web execution
-
isNotMobileExecution
public static boolean isNotMobileExecution()Checks to see if the execution is a web-based execution- Returns:
- true if it's a web-based execution
-
initializeSystemProperties
public static void initializeSystemProperties() -
closeDriver
public void closeDriver() -
closeDriver
@Step("Close Driver Session") public void closeDriver(org.openqa.selenium.WebDriver driver) Closes the given WebDriver session and performs all associated teardown tasks: attaches video recording (if scope is DriverSession), collects WebDriver logs, handles dockerized driver cleanup, and removes the WebDriverManager reference.The method handles the following edge cases gracefully:
- Driver already closed — logs at DEBUG level and continues
nulldriver — logs an informational message and returns- Exceptions during
close()orquit()— caught and logged so the remaining teardown (log attachment, state cleanup) still executes
- Parameters:
driver- the WebDriver instance to close; ifnull, the method is a no-op
-
initializeDriver
public void initializeDriver() -
initializeDriver
-
initializeDriver
public void initializeDriver(org.openqa.selenium.MutableCapabilities customDriverOptions) -
initializeDriver
public void initializeDriver(@NonNull @NonNull DriverFactory.DriverType driverType, org.openqa.selenium.MutableCapabilities customDriverOptions) -
initializeDriver
public void initializeDriver(@NonNull @NonNull org.openqa.selenium.WebDriver driver)
-