--- title: "Implementation" url: https://docs.catalyst.zoho.com/en/smartbrowz/help/browser-logic/implementation/ description: "Code a Catalyst Serverless function to perform any browser task that you would otherwise manually do." last_updated: 2026-08-17T12:16:04Z service: SmartBrowz type: general --- # Implementation Implement the following steps to create and initialize a Browser Logic function through the Catalyst CLI. You can learn about CLI initialization and other CLI operations in detail from the [CLI help docs](https://docs.catalyst.zoho.com/en/cli/v1/cli-command-reference/). Before you initialize your function, you will need to install the browser automation library you require in your local system. The installation instructions for the automation libraries that Catalyst provides templates for are: * [Install Pupeeteer](https://pptr.dev/) * [Install Selenium](https://www.selenium.dev/) * [Install Playwright](https://playwright.dev/) ### Create a Browser Logic Function You can now begin with initializing your browser logic function by either initializing a new project from a local directory, or [adding the function](https://docs.catalyst.zoho.com/en/cli/v1/working-with-functions/add-functions/) in an existing project directory: 1. [Create or initialize the Project](https://docs.catalyst.zoho.com/en/cli/v1/initialize-resources/initialize-new-project/) in the console or through the CLI, and begin [Function Setup](https://docs.catalyst.zoho.com/en/cli/v1/initialize-resources/initialize-functions/) in CLI. 2. Choose *Browser Logic* as the function type, and click **Enter**. ![catalyst_smartbrowz_browser_logic_cli_func_setup](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_cli_func_setup.webp) 3. Choose you preferred function stack, as the latest supported runtime of either *Java* or *NodeJS* and click **Enter**. ![catalyst_smartbrowz_browser_logic_cli_node_select](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_cli_node_select.webp) 4. If you chose to create your function with: - **Java function stack** You can initialize your Browser Logic function with **Selenium** alone. Press **Enter**. ![catalyst_smartbrowz_browser_logic_selenium_javac](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_selenium_javac.webp) - **NodeJS function stack** Choose an automation library of your preference and press **Enter**. ![catalyst_smartbrowz_browser_logic_cli_nodejs_lib](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_cli_nodejs_lib.webp) The Browser Logic function will be be created successfully along with the required project or [function dependencies and configuration files](https://docs.catalyst.zoho.com/en/cli/v1/project-directory-structure/functions-directory/). #### Java: ![catalyst_smartbrowz_browser_logic_java_complete](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_java_complete.webp) #### NodeJS: ![catalyst_smartbrowz_browser_logic_node_complete](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_node_complete.webp) You can now code the function using an IDE of your choice. ### Serve Browser Logic Function Before we test the Browser Logic function, you need to implement the following steps in your local system: * Since Browser Logic only supports Chrome web browsers, you need to download a chrome driver suitable to your operating system from [here](https://googlechromelabs.github.io/chrome-for-testing/#stable.). * Go to `.bashrc` file present in your local system and set the following environment variables: ```json export CHROME_EXECUTABLE_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" // Replace the value with the Chrome driver you dowmloaded earlier export CHROMEDRIVER_EXECUTABLE_PATH="/usr/local/bin/chromedriver" // Replace the value with the local ocation of your Chrome browser ``` Once you have coded your Browser Logic function in an IDE of your choice, you can test the functionality of your function by using the following CLI command: ```sh catalyst serve ``` This CLI command will serve all the resources in your project, including your Browser Logic function. To learn more about Catalyst serve resources, visit this [help document](https://docs.catalyst.zoho.com/en/cli/v1/serve-resources/serve-all-resources/). When you execute the above command, this will start a local serve in your **default port 3000**, and a secure endpoint URL for your function will be generated by Catalyst, and displayed in your CLI. ![catalyst_smartbrowwz_browserlogic_catalyst_serve](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowwz_browserlogic_catalyst_serve.webp) You can use this URL to test your Browser Logic functions in your browser. ### Deploy Browser Logic Function After you have coded and tested your function, you can either deploy it using the Catalyst CLI or you can upload your function to the console as a zip file. #### Deploy using the Catalyst CLI Execute the following command from your project or function directory: ```sh catalyst deploy ``` The function will be deployed to the console, and an Invocation URL will be generated for the function. You can use this URL to directly access the function, use it in code, or for any purpose of your preference that requires you to directly access the function. ![catalyst_smartbrowz_browser_logic_cli_deploy](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_cli_deploy.webp) You can find out more about how catalyst deploy works by visiting this [help page](https://docs.catalyst.zoho.com/en/cli/v1/deploy-resources/introduction/). ### Upload Function as ZIP File in the Console You can upload the function by navigating to **SmartBrowz -> Browser Logic** or by navigating to **Serverless -> Functions**. The steps mentioned below are for uploading the function from the *Browser Logic* section of *SmartBrowz*. Implement the following steps to upload your Browser Logic function to the console: 1. Navigate to the **Browser Logic** component present in the *SmartBrowz* service section in the Catalyst console under *Browser Control*. Click **Create Browser Logic**. ![catalyst_smartbrowz_browser_logic_console_main](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_console_main.webp) 2. Click the **Console** tab. ![catalyst_smartbrowz_browser_logic_console](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_console.webp) 3. Enter the Function Name, and select the Function Stack in which you created your Browser Logic Function. ![catalyst_smartbrowz_browser_logic_console_name_stack](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_console_name_stack.webp) 4. Upload your function directory as a zip file. ![catalyst_smartbrowz_browser_logic_stack_upload](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_stack_upload.webp) While uploading a *Java* or a *Node.JS* function bundle in the console, you must ensure that: * Instead of compressing the function folder as a whole, you must navigate inside the function folder, select all the files in it, and then compress them together. This is because, when Catalyst extracts a Java or Node.js function's zip file, the [`catalyst-config.json`](https://docs.catalyst.zoho.com/en/cli/v1/project-directory-structure/functions-directory/) file must be present in the root. * The function's directory contains all the required configuration files in the [standard structures](https://docs.catalyst.zoho.com/en/cli/v1/project-directory-structure/catalyst-json/). * The function name you enter in the console matches the names configured in `package.json` for Node.js, and `catalyst-config.json` for both Java and Node.js. The zip file's name can be anything. * The stack version you select in the console matches the stack version configured in `catalyst-config.json` for both Java and Node.js functions. 5. **Configure Function Memory**: Catalyst enables you to configure the memory for each of your functions. This memory will be allocated when the function is executed. The default memory allocated for a function is 256 MB. That is, if you don't configure the memory, or if you had created a function before this feature was made available, the memory would be set to 256 MB automatically. You can edit any of your existing functions and change this value as per your requirements. > **Note:** You can optimize the cost and performance of your application by selecting the optimal memory for a function based on the complexity of its code. Refer to the [Cost and Performance Optimization in Functions](https://docs.catalyst.zoho.com/en/serverless/help/functions/optimization/) page for details. You can choose to change the allocated memory of the function by clicking **Show Advanced Option**, and selecting your preferred memory from the **Select Memory** drop-down. ![catalyst_smartbrowz_browser_logic_dunc_memory](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_dunc_memory.webp) > **Node:** The CPU is allocated automatically based on the memory you configure for your function. You won't be able to view or configure this value. 6. Click **Create**. ![catalyst_smartbrowz_browser_logic_console_shot](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_console_shot.webp) The function will be created and listed in the Functions page. A unique Function ID will be created for it and displayed in the page, along with the function's details. ### Function Details After you upload the function to the console, you will be able to view meaningful stats on your function performance and other function details. ![catalyst_smartbrowz_browser_logic_console_shot](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_console_shot.webp) You can also copy and use the secure **Invocation URL** present in the console to access your function directly, pass inputs, or implement it in your code as you require. Similar to other [Serverless function types](https://docs.catalyst.zoho.com/en/serverless/help/functions/introduction/), you can use the Configurations section of the console to: - Add [Environment Variables](https://docs.catalyst.zoho.com/en/serverless/help/functions/implementation/#environmental-variables) ![catalyst_smartbrowz_browser_logic_env_variables](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_env_variables.webp) - Change the [allocated memory](https://docs.catalyst.zoho.com/en/serverless/help/functions/implementation/#allocated-memory) of the function stack. ![catalyst_smartbrowz_browser_logic_memory_console_allocation](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/catalyst_smartbrowz_browser_logic_memory_console_allocation.webp) You can refer to the [Functions Implementation section](https://docs.catalyst.zoho.com/en/serverless/help/functions/implementation/) for more information about these actions. > **Note:** Any Browser action or operation that you code using the Browser Logic function, or any browser automation or web scraping task that you perform using any component of **Catalyst SmartBrowz** is at your own risk. We strongly recommend you use the SmartBrowz components to perform operations on domains that permit the actions, or with proper approval. Additionally, while Catalyst does provide a secure infrastructure to code your functions, any consequence of the logic you code using Catalyst functions is yours alone.