loading...
WayScript

Tutorial: Running Selenium in the cloud on a daily cron schedule

tjmd profile image TJ-MD Originally published at wayscript.com ・1 min read

Start your Monday off with a super short tutorial using Selenium on WayScript. Questions about WayScript? Check out our FAQ.

Introduction

Selenium is a library for automating web browser tasks. With WayScript, you can run selenium code on the cloud on an automated schedule without needing to set up a server or any other infrastructure.

Setting up your Cron Scheduler

Under triggers, select the Time Trigger.

time trigger

Next, set the cadence and time that you want your script to run at (ex. every day at 9am, or once a week on Thursdays, etc.).

trigger mod

Setting up your Python Script

Drag the Python Module into your WayScript flow

mod

Setup your Selenium Headless Browser

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')

browser = webdriver.Chrome(options = options)
browser.set_page_load_timeout(10)

browser.get('https://wayscript.com/')

ps = browser.page_source
print(ps)

browser.close()

All done! Now your selenium code will run

You can also output data from Python to use in other modules such as sending emails, slack messages, etc.

Posted on May 4 by:

tjmd profile

TJ-MD

@tjmd

Helping WayScript and other developer focused companies launch amazing products

WayScript

A rapid scripting platform for developers. Connect to any database and API and build apps fast in any programming language. Get Superpowers.

Discussion

markdown guide