-
Notifications
You must be signed in to change notification settings - Fork 0
Tutorial
[CONSRUCTION]
If you want to use AutoMate, this wiki page was made for you (and if you don't too) ! I assume that it can be tricky to use a new framework that use browser driver, yaml and php at the same time. But wait, this is easy. For real. Just follow this tutorial.
- What is AutoMate
- What is YAML and why
- Install PHP
- Install Composer
- Install AutoMate
- Get a browser driver
- Prepare AutoMate
- Create your configuration file
- Create your scenario
- Create a specification
- Run AutoMate
- Advanced features
- Use variables
- Use conditions
- Use loops
- Create my own command
In this tutorial, we will build a scenario where we will try to get information from Google. The idea is to go to http://google.fr, search something, and get data. The goal is to use most of AutoMate features like scenario, specifications and the maximum of commands available as well as variables.
CONSTRUCTION
YAML (for YAML Ain't Markup Language) is a human friendly data serialization standard for all programming languages. Yes, for data serialization. This is, as you know, not the way AutoMate uses YAML but we consider scenarios as a suite of actions to create moves on the driver. These are not made to change a lot. AutoMate use YAML for that purpose, as a configuration file for a specific scenario.
AutoMate can run with PHP >= v7.3.
MacOS user
Homebrew provides a great helper to install PHP. Just run brew install php
or brew install php@7.3
to install a specific version.
Add it to your path to use PHP on your Terminal. Run the following commands :
$ nano ~/.bash_profile
Add this line at the end of file and replace php@X by your php version (ex : php@7.3):
export PATH="/usr/local/opt/php@X/sbin:$PATH"
Then source your bash_profile to update the available commands : You can source .bash_profile everytime you open your terminal follow this link
$ source ~/.bash_profile
$ php -v
The last line should print the PHP version installed.
Linux user
You're a CLI professionnal and you will use sudo apt-get install php
to install PHP. For a specific version, you would use sudo apt-get install php7.3
.
This line should print the PHP version
$ php -v
Windows user
Find the version installer and install PHP on your machine.
Then add it to your environment variables.
Composer is package manager. It can download dependencies, and AutoMate has dependencies.
Run the following :
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
Now, you can add composer to your $path. For MacOS and Ubuntu/Linux the following commands should work :
On Linux
$ echo 'alias composer="php /path/to/composer.phar"' >> ~/.bashrc
$ source ~/.bashrc
On MacOS
$ echo 'alias composer="php /path/to/composer.phar"' >> ~/.bash_profile
$ source ~/.bash_profile
On Windows
You can add it to your environment variables
Now we have php and composer, we can install AutoMate using Composer. It will download AutoMate package and dependencies in a vendor folder. So we need to setup our project.
Create your project folder named "google-automation" (mkdir google-automation
) then download AutoMate :
composer require jugid/auto-mate
As I cannot detail for every browser driver, I will use chromedriver as an example.
You need to download Chrome or Chromium if you also want to use chromedriver
Go to the chromedriver download page and click on the version of Chrome you have download. Download the executable for your system.
Now, we have everything we technically need. We can prepare AutoMate to run our scenario.
AutoMate Wiki - v0.8.0 - This wiki can change at any moment