Skip to content

Instantly share code, notes, and snippets.

@runo280
Created March 30, 2020 11:51
Show Gist options
  • Save runo280/f059ce2d67f0b75abdc02f08376444c5 to your computer and use it in GitHub Desktop.
Save runo280/f059ce2d67f0b75abdc02f08376444c5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# coding=utf8
import time
import os
import sys
from pyvirtualdisplay import Display
from selenium import webdriver
reload(sys)
sys.setdefaultencoding('utf8')
display = Display(visible=0, size=(1366, 768))
display.start()
driver = webdriver.Firefox(executable_path='/usr/local/bin/geckodriver')
driver.get('https://ecare.asiatech.ir/Login.aspx')
driver.find_element_by_id('#').click()
# your username
elem = driver.find_element_by_id('txtUserName')
elem.send_keys(os.environ['asiatech_user'])
# your password
elem = driver.find_element_by_id('txtPassword')
elem.send_keys("asiatech_pass")
driver.find_element_by_id('btnLogin').click()
time.sleep(7)
elem = driver.find_element_by_id('divGig0')
elem2 = driver.find_element_by_id('divDay0')
time.sleep(5)
txt = "ترافیک باقی مانده: {} \n زمان باقی مانده: {}".format(elem.text, elem2.text)
os.system("notify-send asiatech.ir \"{}{}".format(txt, '"'))
driver.quit()
display.stop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment