Automating some workflows in Google Groups using the Selenium Python library.
-
Download files
-
Create a file called
credentials.json
and provide the encrypted password and username, the file paths to theemail.txt
andlogs.txt
file, the path to the Chrome Driver, as well as the three links required:
{
"cdPath" : "",
"emailText" : "",
"logText" : "",
"username" : "",
"password" : "",
"linkOne" : "",
"linkTwo" : "",
"linkThree" : ""
}
-
Create a file called
email.txt
and provide the email response that will be sent when a support inquiry is made during off hours -
Create a file called
logs.txt
, which will be used to store the logs for the automation script
-
selenium
-
schedule
-
Chrome (59 and above)
-
chromedriver
-
flask
-
Simply run the flask web server using
python app.py
-
The scripts are run depending on which API call is made:
http://localhost:5000/enable
will enable the email automation workflow, andhttp://localhost:5000/disable
will disable the email automation workflow
-
It is possible to use the
schedule
library to regularly schedule the email automation process to run (see themain.py
file for examples on how to do this. -
In the current deployment, a separate program is used to make the API calls, and the scheduling is handled by that separate program.
-
The
main.py
file uses theschedule
module to schedule the task.
-
Implement as a production web server (use flask) and keep as a self-contained web application.
-
Refactor to improve readability and performance
-
Refactor to locate web elements that would change less often
-
Refactor for better Python programming best practices
-
Refactor to reuse code instead of repeating
- The login function should be the same for both
turnoff.py
andturnon.py
- The login function should be the same for both