Class EngineService
java.lang.Object
com.shaft.mcp.EngineService
-
Constructor Summary
ConstructorsConstructorDescriptionCreates the default engine service, wiring a defaultPlaywrightServicefor direct Java callers and tests that construct this class without Spring. -
Method Summary
Modifier and TypeMethodDescriptionvoidGenerate a test report for the current session.Get the source code of the current page.voidinitializeDriver(BrowserType targetBrowser) Java-caller convenience overload defaultingenginetoActiveEngine.WEB; not an MCP tool.voidinitializeDriver(BrowserType targetBrowser, ActiveEngine engine, McpMobileInitOptions mobileOptions) Initializes the WebDriver for the specified browser type, or another engine session whenengineselects one.voidQuits whichever engine session is currently active (web, mobile, or Playwright), closing all associated browser windows.
-
Constructor Details
-
EngineService
public EngineService()Creates the default engine service, wiring a defaultPlaywrightServicefor direct Java callers and tests that construct this class without Spring.
-
-
Method Details
-
initializeDriver
@Tool(name="driver_initialize", description="launches browser, Playwright, or a mobile session; optional engine selects web (default) | playwright | mobile_native | mobile_web; for mobile engines, optional nested mobileOptions carries native/web-emulation parameters, absorbing mobile_initialize_native/mobile_initialize_web_emulation") public void initializeDriver(@ToolParam(required=false,description="browser to launch on the WEB engine; blank/omitted defers to the configured targetBrowserName property (default chrome); PLAYWRIGHT/MOBILE engines resolve their own default independently") BrowserType targetBrowser, @ToolParam(required=false) ActiveEngine engine, @ToolParam(required=false) McpMobileInitOptions mobileOptions) Initializes the WebDriver for the specified browser type, or another engine session whenengineselects one.- Parameters:
targetBrowser- The type of browser to initialize (e.g., CHROME, FIREFOX).engine- which engine to start; blank/omitted defaults toActiveEngine.WEB.ActiveEngine.PLAYWRIGHTstarts a SHAFT Playwright session instead of a WebDriver session.ActiveEngine.MOBILE_NATIVE/ActiveEngine.MOBILE_WEBstart an Appium native or Chrome/Edge mobile-emulation session usingmobileOptions(design doc amendment A9).mobileOptions- optional nested request carrying the union of the formermobile_initialize_native/mobile_initialize_web_emulationparameters; only read whenengineis a mobile engine; unset fields resolve fromSHAFT.Propertiesexactly as those tools did
-
initializeDriver
Java-caller convenience overload defaultingenginetoActiveEngine.WEB; not an MCP tool.- Parameters:
targetBrowser- The type of browser to initialize (e.g., CHROME, FIREFOX).
-
quitDriver
@Tool(name="driver_quit", description="closes whichever engine session (web, mobile, or Playwright) is currently active") public void quitDriver()Quits whichever engine session is currently active (web, mobile, or Playwright), closing all associated browser windows. -
generateTestReport
@Tool(name="generate_test_report", description="generates a test report for the current session") public void generateTestReport()Generate a test report for the current session. This method compiles and generates a detailed test report based on the actions performed during the session. It utilizes SHAFT's reporting capabilities to create a comprehensive report that includes information such as test steps, outcomes, screenshots, and logs. The generated report is saved in a predefined location for easy access and review. This method should be called at the end of the test session to ensure all actions are documented. -
getPageSource
Get the source code of the current page. This is a support method for the AI agent to better explore the page.- Returns:
- The HTML source code of the current page as a string.
-