Welcome to the SeleniumApp template guide! This template is designed to help you build applications that require web automation, such as end-to-end tests, functional tests, or web crawling with sophisticated interactions like clicks and element retrieval. The SeleniumApp template uses Selenium for browser automation, FastAPI for creating a web server, and Jinja2 for templating HTML responses.
To begin using this template, simply click on "Start with this Template" in the Lazy Builder interface. This will pre-populate the code in your workspace, so you won't need to copy or paste any code manually.
Once you have the template ready, press the "Test" button to start the deployment process. The Lazy platform will handle the deployment, and you won't need to worry about installing libraries or setting up the environment.
After pressing the "Test" button, if the app requires any user input, the Lazy CLI will prompt you to provide it. For this template, there is no user input required through the CLI, so you can proceed to the next step.
After deployment, Lazy will provide you with a dedicated server link to access your app. Since this template uses FastAPI, you will also receive a link to the FastAPI documentation, which can be useful for understanding how to interact with your API.
To view the page title fetched by Selenium, simply navigate to the server link provided by Lazy. You will see a simple HTML page rendered with the title of the page you fetched using Selenium.
If you need to integrate this app into another service or frontend, you can use the server link provided by Lazy as the base URL for your API calls. For example, if you want to fetch the page title from a different frontend, you can make a GET request to the "/" endpoint of your server link.
Here's a sample code snippet that you could use in an external tool to make a request to your FastAPI server:
fetch('YOUR_LAZY_SERVER_LINK/')
.then(response => response.text())
.then(html => {
// Process the HTML response here
console.log(html);
})
.catch(error => console.error('Error fetching page title:', error));
Replace 'YOUR_LAZY_SERVER_LINK' with the actual server link provided by Lazy.
And that's it! You've successfully deployed and integrated an app using the SeleniumApp template on Lazy. Enjoy automating the web!