This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#create a database | |
CREATE DATABASE avitek; | |
#create employees table | |
USE avitek; | |
CREATE TABLE employees ( | |
id int NOT NULL AUTO_INCREMENT, | |
first_name varchar(255), | |
last_name varchar(255), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# My first script | |
echo "Hello World!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check if python is installed - it should return something similiar to this "Python 3.6.7" | |
python --version | |
# check if pip is installed - it should return something similiar to this "pip 19.1.1 from <your_path>" | |
pip --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run the python file you just created in the current directory(should be headless_test dir) | |
python automate_download.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
import os | |
# function to take care of downloading file | |
def enable_download_headless(browser,download_dir): | |
browser.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command') | |
params = {'cmd':'Page.setDownloadBehavior', 'params': {'behavior': 'allow', 'downloadPath': download_dir}} | |
browser.execute("send_command", params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install selenium | |
pip install selenium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This command will install virtualenv | |
pip install virtualenv | |
# This command will create our virtual env with python3 installed | |
virtualenv -p python3 env | |
# ONLY RUN THIS COMMAND if you get an error from the above command(windows users issue perhaps) | |
virtualenv -p python env | |
# This command will activate our virtual envirnoment and allow us to work with contained dependencies | |
source env/bin/activate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make directory/folder to store our project files | |
mkdir headless_test | |
# change directory to the directory we just created | |
cd headless_test |