Skip to content

Instantly share code, notes, and snippets.

@JeffreyKozik
Created January 28, 2022 02:06
Show Gist options
  • Save JeffreyKozik/76ed341165ea64e06160ae5b386336ad to your computer and use it in GitHub Desktop.
Save JeffreyKozik/76ed341165ea64e06160ae5b386336ad to your computer and use it in GitHub Desktop.
username = ""
password = ""
TESTING = True
url = ""
# selenium dependencies
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
waiting_time = 1000
options = Options()
# https://stackoverflow.com/questions/60247155/how-to-bypass-the-message-your-connection-is-not-private-on-non-secure-page-us
options.add_argument('--ignore-ssl-errors=yes')
options.add_argument('--ignore-certificate-errors')
options.add_argument('--headless')
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
driver.get(url)
email_input = WebDriverWait(driver, waiting_time).until(
EC.element_to_be_clickable((By.XPATH, '//input[@id="LoginCredentials_UserName"]')))
email_input.send_keys(username)
password_input = WebDriverWait(driver, waiting_time).until(
EC.element_to_be_clickable((By.XPATH, '//input[@id="LoginCredentials_Password"]')))
password_input.send_keys(password)
login_button = WebDriverWait(driver, waiting_time).until(
EC.element_to_be_clickable((By.XPATH, '//button[@id="btnLogin"]')))
login_button.click()
my_account_button = WebDriverWait(driver, waiting_time).until(
EC.element_to_be_clickable((By.XPATH, "//*[contains(text(), 'My Account')]")))
my_account_button.click()
pay_my_bill_button = WebDriverWait(driver, waiting_time).until(
EC.element_to_be_clickable((By.XPATH, '//a[@id="btnPayMyBillbtm"]')))
pay_my_bill_button.click()
pay_now_button = my_account_button = WebDriverWait(driver, waiting_time).until(
EC.element_to_be_clickable((By.XPATH, '//input[@id="btnSubmit"]')))
pay_now_button.click()
payment_amount_input = my_account_button = WebDriverWait(driver, waiting_time).until(
EC.element_to_be_clickable((By.XPATH, '//input[@id="EpayAccounts_0__AmountDue"]')))
payment_amount_input.send_keys("50")
continue_button = WebDriverWait(driver, waiting_time).until(
EC.element_to_be_clickable((By.XPATH, '//a[@id="btnContinue"]')))
continue_button.click()
this_card_button = WebDriverWait(driver, waiting_time).until(
EC.element_to_be_clickable((By.XPATH, '//input[@id="use-wallet"]')))
this_card_button.click()
review_button = WebDriverWait(driver, waiting_time).until(
EC.element_to_be_clickable((By.XPATH, '//input[@value="Review Your Payment"]')))
review_button.click()
if (not TESTING):
submit_payment_button = WebDriverWait(driver, waiting_time).until(
EC.element_to_be_clickable((By.XPATH, '//input[@id="btnSubmit"]')))
submit_payment_button.click()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment