Hosting a Selenium on Square Cloud
This article guides you to automate web navigation using Selenium and Chromium on Square Cloud.
Creating a New Selenium Script
- Before you start, make sure you have Python and pip installed on your system. If you don’t have them yet, you can download them from the official Python website and the official Pip website.
- Next, you will need to create an account on Square Cloud, which can be done through the sign up page. You can use your email to create an account.
- Finally, you need to have an active paid plan on your account. You can view our plans and purchase one according to your needs here.
With Python and pip installed, you can create a new Selenium script. First, install Selenium using pip:
Next, create a new Python file (for example, main.py
) and add the following code to create a basic Selenium script:
Managing Dependencies with the requirements.txt file
The requirements.txt
file is a file that lists all the external libraries needed for your project. You should list all the libraries that your project will use, excluding native libraries like random
and datetime
. This file should be included when submitting your application to Square Cloud.
Chromium path
In the example provided above, it’s not necessary to explicitly define the Chromium path because the Selenium WebDriver can automatically find the browser if it’s installed in a standard system location. The ChromeDriver, specified with Service('/usr/bin/chromedriver')
, knows where to look for the Chromium/Chrome executable.
In Square Cloud, Chromium is installed in /usr/bin/chromium
, which is standard. Therefore, the Selenium WebDriver can automatically locate it through the specified ChromeDriver. Thus, there’s no need to explicitly specify the Chromium path in the code, unless there are specific reasons to do so, such as custom installations or different environment configurations.
Creating the squarecloud config file
Learn about: how to make the configuration file for Square Cloud.
The squarecloud.app file is a configuration file that will be used to configure your application; it will be used to define the name, description, version, main file, among other things.
Uploading Project to Square Cloud
After preparing your project files, you can now upload them to Square Cloud and host your project.
Access the Square Cloud Dashboard and upload your project files.
Additional Resources
For more information about Selenium and its tools, visit the official Selenium documentation. There, you’ll find detailed guides, tutorials, and API documentation to help you make the most out of Selenium.
If you continue to experience any issues, please don’t hesitate to contact our support team.
Was this page helpful?