A package to simplify browser automation
Project description
BrowserAutomator
BrowserAutomator is a package to help you easily control websites using a simple YAML configuration.
Installation
Using pip for Python 3:
pip install BrowserAutomator
Configuration
setup yml
In these files you can specify actions that are run in the given order when the utility is started.
The following actions are available:
-
wait
: given a time unit (seconds, minutes, hours, days) and an amount of time, blockingly waits for the amount of time -
load
: given an url, opens the site in the current tab -
new_tab
: given an url, opens the site in a new tab -
switch_tabs
: given the index of a tab, switches to the specified tab -
interact
: given thetype
of an html element and itsname
(andcontent
), the element gets clicked on if nocontent
tag is given. Otherwise it get treated like a text field and thecontent
is used as inputThe following types are available:
id
,name
,class
,css
,xpath
,tag_name
-
for_every
: given a list ofurls
and a list ofactions
, runs the actions on every url. Urls inload
andnew_tab
actions are replaced by the current url
loop yml
In these files you can specify actions that loop after the setup ran once. The following actions are available:
repeat every
: given a time unit (seconds, minutes, hours, days) and an amount of time, restarts the script every n seconds/minutes/...fix wifi
: given a time unit and an amount of time, checks every n seconds/minutes/... if the network is working, and restarts the script if it doesn'tswitch tabs
: given a time unit and an amount of time, switches the next tab every n seconds/minutes/... If the last tab is reached, it goes back to the first
Usage
In Python:
from BrowserAutomator.setup import run
run([your_setup_yml_filenames], [your_loop_yml_filenames], your_chromedriver_path)
the default Chromedriver path is "/usr/lib/chromium-browser/chromedriver"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.