Python Code Optimizations

This commit is contained in:
Michael Reber 2019-11-14 16:25:21 +01:00
parent 7cd6644527
commit fbb1247ebf

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from selenium import webdriver
import time
#import gmail_nrg_code as nrg_code
print("© 2019 Michael Reber . ALL RIGHTS RESERVED.")
print("Created to win the endless energy game..")
@ -12,7 +11,7 @@ print("Patience you must have, my young padawan.")
driver = webdriver.Chrome(executable_path=r"D:\Energy-Bot-2019\chromedriver.exe")
driver.get("https://game.energy.ch/")
# assert "Energy" in driver.title
answers = [
#################################################################
@ -106,8 +105,6 @@ def press_answer(quest_nr):
question_Nr = 0
counter = 0
input("Press to enter script")
#print("Enter Phone Nr: (do not enter starting '0'!) Example: 798765432")
#tel_nr = int(input("+41"))
print("Enter Your Energy Registered Account Email:")
account_mail = input("Email: ")
@ -133,12 +130,6 @@ while True:
except:
try:
try:
#elem3 = driver.find_elements_by_xpath("//input[@placeholder='Handynummer']")[0]
#elem3.send_keys(tel_nr)
#elem1 = driver.find_elements_by_xpath("//button[@class='btn btn-primary game-button btn-lg']")[0]
#elem1.click()
try:
energyLogin = driver.find_elements_by_xpath("//input[@name='email']")[0]
energyLogin.send_keys(account_mail)
@ -152,26 +143,6 @@ while True:
elem4.click()
except:
pass
#found_mail = False
#while found_mail is False:
# sms_code = nrg_code.main()
# if sms_code is not None:
# found_mail = True
# print(sms_code + "....................................................")
# code_numb_list = []
# for numb in sms_code:
# code_numb_list.append(numb)
# driver.find_elements_by_xpath("//input[@id='1']")[0].send_keys(code_numb_list[0])
# driver.find_elements_by_xpath("//input[@id='2']")[0].send_keys(code_numb_list[1])
# driver.find_elements_by_xpath("//input[@id='3']")[0].send_keys(code_numb_list[2])
# driver.find_elements_by_xpath("//input[@id='4']")[0].send_keys(code_numb_list[3])
# elem1 = \
# driver.find_elements_by_xpath(
# "//button[@class='btn btn-primary game-button btn-lg btn-declined']")[0]
# elem1.click()
# else:
# time.sleep(5)
except:
pass
elem1 = driver.find_elements_by_xpath("//button[@class='btn btn-primary game-button btn-lg']")[0]