Run scraper code on Linux while Kameleo is running on Windows

  • Created

While currently Kameleo is only compatible with Windows machines you can still run your scraper on Linux / MacOS while it interacts with Kameleo. If you follow this method you will be able to run Selenium / Puppeteer / Playwright on Linux / MacOS while Kameleo.CLI is installed to a server.

Please note that Kameleo will be available on MacOS and Linux very soon.

To properly understand this article please first understand one of the articles from this section, depending on which autoamtion framework you prefer to use.

In this guide, we'll walk through the steps required to use Kameleo.CLI on a Windows machine and to launch Playwright instances on a Linux machine. This setup involves configuring Kameleo.CLI to expose the Local REST API endpoint, allowing communication between the Windows machine (hosting Kameleo.CLI) and a Linux machine (where Playwright will be used).

Prerequisites

  1. Windows machine with Kameleo.CLI installed and running.
  2. Linux machine with Playwright installed and accessible from the network.
  3. Basic understanding of networking and API configuration.

Below we have a chart that showcases the interaction between Linux and Windows:

  • The Linux machine is running the Playwright script
  • The Windows machine is running Kameleo and a browser is started by Kameleo
  • The Playwright script is interacting with Kameleo and the browser as well
Chart.PNG

Set up

  • Configure Kameleo.CLI on Windows

    First, ensure that Kameleo.CLI is running on your Windows machine and accessible from the network. Follow these steps:

    • Open Port 5050: If not already open, configure your Windows firewall to allow incoming connections on port 5050.
    • Verify Accessibility: From the Linux machine, try accessing http://IP_OF_WINDOWS_MACHINE:5050/swagger in a web browser. You should see the Kameleo.CLI API documentation, confirming that the API is reachable.
  • Update Client Configuration

    Next, update your client configuration to connect to Kameleo.CLI using its network IP address

    • const kameleoPort = 5050;
      const client = new KameleoLocalApiClient({
        baseUri: `http://IP_OF_WINDOWS_MACHINE:${kameleoPort}`,
        noRetryPolicy: true,
      });

      Replace IP_OF_WINDOWS_MACHINE with the actual IP address of your Windows machine.

    • kameleo_port = 5050
      client = KameleoLocalApiClient(
        endpoint=f'http://IP_OF_WINDOWS_MACHINE:{kameleo_port}',
        retry_total=0
      )

      Replace IP_OF_WINDOWS_MACHINE with the actual IP address of your Windows machine.

  • Launch Playwright Instances on Linux

    Now, configure Playwright on your Linux machine to connect to the Kameleo.CLI instance running on Windows:

    • const browserWSEndpoint = `ws://IP_OF_WINDOWS_MACHINE:${kameleoPort}/playwright/${profile.id}`;

      Again, replace IP_OF_WINDOWS_MACHINE with the IP address of your Windows machine.

    • browser_ws_endpoint = f'ws://IP_OF_WINDOWS_MACHINE:{kameleo_port}/playwright/{profile.id}'

      Again, replace IP_OF_WINDOWS_MACHINE with the IP address of your Windows machine.

  • Testing

    Ensure both machines are on the same network and can communicate with each other.

    Run your Playwright scripts on the Linux machine, connecting to Kameleo.CLI on the Windows machine using the updated IP address and port.

Was this article helpful?

0 out of 0 found this helpful