
NOTICE: All information contained herein is, and remains
the property of TechnoCore.
The intellectual and technical concepts contained
herein are proprietary to TechnoCore and dissemination of this information or reproduction of this material
is strictly forbidden unless prior written permission is obtained
from TechnoCore.
The ObjServiceScreenshot service provides a robust mechanism for capturing screenshots of web pages. It is designed to be executed either from a workflow or directly from the command line.
The service uses a headless instance of Google Chrome, controlled by Selenium, to render a web page and save it as a PNG image. It includes built-in validation to ensure the generated screenshots are valid and not blank.
google-chrome-stable to be installed on the host system. A helper script to install it on Debian-based systems is located at resource.bin/install_chrome.sh. To run the script, execute the following command from the project root:bash resource.bin/install_chrome.sh
selenium: For browser automation.webdriver-manager: To automatically manage the Chrome driver binary.Pillow: Used by the validation module to analyze the screenshot image.These dependencies are included in resource.config/requirements.txt.
Compute method)The main logic resides in the Compute method. It performs the following steps:
local.documents/screenshots/ directory.The service uses a specific logic for naming the output file:
Param2 or the --filename flag), that name is used.<guid>_screenshot.png.run_workflow_direct)The service is designed to be called from the project's workflow engine.
Parameters:
| Parameter | Description | Example |
|---|---|---|
Guid |
The unique identifier for the operation. If left empty, a new GUID is generated. | 20250906_0040_2EPNNUUaTrYdHqqu5bBknP_ |
Param1 |
(Required) The full URL of the web page to capture. | "https://www.google.com" |
Param2 |
(Optional) The desired output filename. | "google_homepage.png" |
Param3 |
(Optional) The dimensions for the screenshot in "widthxheight" format. |
"1280x720" |
The service includes a command-line interface for direct execution and testing.
Command Structure:
python3 factory.service/package.core/ObjServiceScreenshot.py <url> [options]
Arguments & Options:
url: (Required) The full URL to capture.-f, --filename: (Optional) The output filename.--width: (Optional) The browser window width. Defaults to 1920.--height: (Optional) The browser window height. Defaults to 1080.Example:
# Take a 1280x720 screenshot of youtube.com
python3 factory.service/package.core/ObjServiceScreenshot.py "https://www.youtube.com" --width 1280 --height 720
For CLI executions, a validation step automatically runs after a screenshot is successfully created. The TestScreenshotMethods class performs these checks:
A dedicated pytest test case is available to ensure the service functions correctly. It can be run with the following command:
pytest resource.test/pytests/factory.service/test_ObjServiceScreenshot.py
cythonize -3 -a -i ObjServiceScreenshot.py
Compiling /home/axion/projects/axion/factory.service/package.core/ObjServiceScreenshot.py because it changed..[1/1] Cythonizing /home/axion/projects/axion/factory.service/package.core/ObjServiceScreenshot.py
Updated : 2025-09-10