History: Browser Automation
Preview of version: 12
Browser Automation
New to Tiki17
See Browser Automation for a list of use cases this opens up.
Browser Automation is based on PhantomJS and CasperJS
Headless Browser Integration in Tiki
What is it ?
Headless Browser Integration refers to running the browser in a "headless" mode, meaning it operates without a graphical user interface (GUI). This allows automated browsing, testing, and rendering of web pages in the background. In Tiki, integrating Headless Browser enables advanced scripting and automation capabilities, such as generating screenshots, running tests, or processing web content programmatically.
Tiki supports two methods for headless browser integration:
- CasperJS Integration (legacy method)
- Direct Chrome Integration (modern alternative)
Below, each method is explained with its setup process and requirements.
1. With CasperJS
CasperJS in Tiki enhances its functionality by providing a robust, scriptable browser engine. A navigation scripting and testing utility, acts as the bridge to enable this feature, making it accessible within Tiki’s ecosystem.
How It Works?
CasperJS leverages a headless browser engine to execute scripts and interact with web pages. In Tiki, this integration is configured through a plugin and package installation. Once enabled, Tiki can use CasperJS to perform tasks like automated page rendering or testing without requiring a visible browser window. The feature is controlled via Tiki’s settings, where administrators can activate and configure it.
Requirements
- Administrative access to Tiki to enable the plugin and install the package.
Setup Process
1. Enable the CasperJS Plugin
- Navigate to: Settings > General Settings > Editing and Plugins > PluginTab
- Locate the CasperJS Plugin and enable it.
2. Install the CasperJS Package
- Go to: Settings > Advanced > Packages
- Search for and install the package jerome-breton/casperjs-installer.
- Note: This installs the necessary CasperJS files and dependencies.
2. With Direct Chrome Integration
Headless Chrome Integration involves running Google Chrome in a headless mode (without a graphical user interface) and programmatically controlling it. This setup is often used for tasks such as automation, web scraping, testing, and performance monitoring.
How It Works?
Headless Chrome is a version of the Chrome browser that operates without displaying a user interface. It behaves the same way as Chrome with a GUI, except it doesn't render any visual content to the screen. This makes it lightweight, faster, and more resource-efficient for automated tasks.
Requirements
- Administrative access to Tiki.
- Chrome installed on the server (required to utilize Headless Chrome functionality).
Setup Process
1. Enable the preference fgal_use_casperjs_to_export_images (previously relying on CasperJS)
- Navigate to: Settings > File Galleries > Editing and Plugins > Settings for Diagrams
- Locate the "Use locally CasperJS to export images" preference and enable it.
2. Choose the Headless Browser Integration Type
- Access: Settings > General Settings > Headless Browser Integration
- Find the "Headless Browser Integration Type" (headlessbrowser_integration_type).
- Select "Direct Chrome Integration" as type.
- Note:
- This configures Tiki to use Headless Chrome Integration as the headless browser engine.
- Headless Chrome Integration requires Chrome Binary Path to work. This is automatically detected if not defined.
How to test ?
After completing the setup, test the integration by running a supported task in Tiki (e.g., generating a page screenshot, downloading a PDF or executing a script). Successful execution confirms that Headless Browser Integration is working.
With these steps, Headless Browser integration is fully enabled in Tiki via CasperJS, allowing for advanced automation and scripting capabilities within the platform.