Giter Site home page Giter Site logo

playground_icbc's Introduction

ICBC

icbc driving test check of availability

Install / Pre-Install

$ pip3 install pipenv
$ pipenv install pytest --dev
$ pipenv install selenium --dev
$ sudo curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add
$ sudo bash -c "echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' >> /etc/apt/sources.list.d/google-chrome.list" 
$ sudo apt -y update
$ sudo apt -y install google-chrome-stable 
$ google-chrome --version 
Google Chrome 95.0.4638.54

- find correct version here: https://sites.google.com/chromium.org/driver/downloads
$ wget https://chromedriver.storage.googleapis.com/95.0.4638.17/chromedriver_linux64.zip 
$ unzip chromedriver_linux64.zip
$ rm chromedriver_linux64.zip
$ ./chromedriver 
Starting ChromeDriver 95.0.4638.17 (a9d0719444d4b035e284ed1fce73bf6ccd789df2-refs/branch-heads/4638@{#178}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.

$ sudo cp -v chromedriver /usr/bin/

Config

Use the same information you are using for https://onlinebusiness.icbc.com/webdeas-ui/home

$ cp test_icbc.ini.example test_icbc.ini
$ vim test_icbc.ini
...

Run

$ pipenv run python -m pytest -s tests/test_icbc.py | tee test_icbc.log | grep '\[I\]:'
[I]: Friday, April 22nd, 2022 - Langley driver licensing (Willowbrook Center)
[I]: Monday, April 25th, 2022 - Langley driver licensing (Willowbrook Center)
[I]: Tuesday, March 8th, 2022 - Port Coquitlam driver licensing
[I]: Wednesday, April 13th, 2022 - Port Coquitlam driver licensing
[I]: Wednesday, April 20th, 2022 - Port Coquitlam driver licensing
[I]: Monday, April 25th, 2022 - Port Coquitlam driver licensing

TELEGRAM

Prerequirement

$ cd tests
$ wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
$ chmod +x jq-linux64 
$ mv jq-linux64 jq

Config

Create bot tocken in Telegram by asking @BotFather and send one message to your bot

$ cp telegram.ini.example telegram.ini
$ vim telegram.ini
...

Sending message

$ ./telegram.sh "a b c d - test"
#first time it wil get a chatid - for now only working with one chatid

$ ./telegram.sh "abcd - test2"
#this message will be delivered to your telegram

Full command

playground_icbc$ pipenv run python -m pytest -s tests/test_icbc.py | grep '\[I\]:' | grep -e "October" -e "November" -e "December" -e "January" | while read line; do tests/telegram.sh "$line"; done

or

$ ./all.sh

playground_icbc's People

Contributors

artickl avatar

Watchers

 avatar

playground_icbc's Issues

Can't run in cronjob

need to move to virtual desktop to be able to run in background

DISPLAY=:0 python all.sh

or

pip3 install pyvirtualdisplay
sudo apt-get install xvfb
...
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from pyvirtualdisplay import Display
import time

# Display creates a virtual frame buffer and manages it for you
with Display(visible=False, size=(1200, 1500)):
    driver = webdriver.Firefox()
    driver.get("https://website-target.com")

    time.sleep(1)

    print(driver.current_url) # check connection

    time.sleep(1)

    print(driver.current_url)

    driver.close()

More info: https://stackoverflow.com/questions/23908319/run-selenium-with-crontab-python

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.