2023-08-17, update for cityline password input

master
CHUN YU YAO 2023-08-20 13:28:58 +08:00
parent ef74427aa0
commit 11eb7e686d
4 changed files with 16 additions and 66 deletions

View File

@ -54,7 +54,7 @@ import webbrowser
import argparse import argparse
import chromedriver_autoinstaller import chromedriver_autoinstaller
CONST_APP_VERSION = "MaxBot (2023.08.16)" CONST_APP_VERSION = "MaxBot (2023.08.17)"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt" CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
@ -6476,67 +6476,17 @@ def kktix_login(driver, account, password):
return ret return ret
def cityline_login(driver, account, password): def cityline_login(driver, account, password):
ret = False is_email_sent = assign_text(driver, By.CSS_SELECTOR, 'input[type="text"]', account, submit=True)
el_email = None
try:
el_email = driver.find_element(By.CSS_SELECTOR, 'input[type="text"]')
except Exception as exc:
pass
is_visible = False # press "click here" use password to login.
if el_email is not None:
try:
if el_email.is_enabled():
is_visible = True
except Exception as exc:
pass
is_email_sent = False
if is_visible:
try:
inputed_text = el_email.get_attribute('value')
if inputed_text is not None:
if len(inputed_text) == 0:
el_email.send_keys(account)
el_email.send_keys(Keys.ENTER)
is_email_sent = True
else:
if inputed_text == account:
is_email_sent = True
except Exception as exc:
pass
# press password to login.
if is_email_sent: if is_email_sent:
is_click_here_pressed = force_press_button(driver, By.CSS_SELECTOR,'.otp-box > ul > li:nth-child(3) > a') is_click_here_pressed = force_press_button(driver, By.CSS_SELECTOR,'.otp-box > ul > li:nth-child(3) > a')
el_pass = None
if is_email_sent:
try:
el_pass = driver.find_element(By.CSS_SELECTOR, 'input[type="password"][aria-label="Password"]')
except Exception as exc:
pass
is_password_sent = False is_password_sent = False
if el_pass is not None: if is_email_sent:
try: is_password_sent = assign_text(driver, By.CSS_SELECTOR, 'div > input[type="password"]', password, submit=True)
if el_pass.is_enabled():
inputed_text = el_pass.get_attribute('value')
if inputed_text is not None:
if len(inputed_text) == 0:
el_pass.click()
if(len(password)>0):
el_pass.send_keys(password)
el_pass.send_keys(Keys.ENTER)
is_password_sent = True
time.sleep(0.1)
except Exception as exc:
pass
ret = is_password_sent return is_password_sent
return ret
def urbtix_login(driver, account, password): def urbtix_login(driver, account, password):
ret = False ret = False

View File

@ -22,7 +22,7 @@ import base64
import threading import threading
import subprocess import subprocess
CONST_APP_VERSION = "MaxBot (2023.08.16)" CONST_APP_VERSION = "MaxBot (2023.08.17)"
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json" CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -34,7 +34,7 @@ warnings.simplefilter('ignore',InsecureRequestWarning)
import ssl import ssl
ssl._create_default_https_context = ssl._create_unverified_context ssl._create_default_https_context = ssl._create_unverified_context
CONST_APP_VERSION = "MaxBot (2023.08.16)" CONST_APP_VERSION = "MaxBot (2023.08.17)"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt" CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
@ -2388,7 +2388,7 @@ def AboutTab(root, language_code):
lbl_help = Label(frame_group_header, text=translate[language_code]['help']) lbl_help = Label(frame_group_header, text=translate[language_code]['help'])
lbl_help.grid(column=0, row=group_row_count, sticky = E) lbl_help.grid(column=0, row=group_row_count, sticky = E)
lbl_help_url = Label(frame_group_header, text=URL_HELP, fg="blue", cursor="hand2") lbl_help_url = Label(frame_group_header, text=URL_HELP, fg="blue", bg="gray", cursor="hand2")
lbl_help_url.grid(column=1, row=group_row_count, sticky = W) lbl_help_url.grid(column=1, row=group_row_count, sticky = W)
lbl_help_url.bind("<Button-1>", lambda e: open_url(URL_HELP)) lbl_help_url.bind("<Button-1>", lambda e: open_url(URL_HELP))
@ -2397,7 +2397,7 @@ def AboutTab(root, language_code):
lbl_donate = Label(frame_group_header, text=translate[language_code]['donate']) lbl_donate = Label(frame_group_header, text=translate[language_code]['donate'])
lbl_donate.grid(column=0, row=group_row_count, sticky = E) lbl_donate.grid(column=0, row=group_row_count, sticky = E)
lbl_donate_url = Label(frame_group_header, text=URL_DONATE, fg="blue", cursor="hand2") lbl_donate_url = Label(frame_group_header, text=URL_DONATE, fg="blue", bg="gray", cursor="hand2")
lbl_donate_url.grid(column=1, row=group_row_count, sticky = W) lbl_donate_url.grid(column=1, row=group_row_count, sticky = W)
lbl_donate_url.bind("<Button-1>", lambda e: open_url(URL_DONATE)) lbl_donate_url.bind("<Button-1>", lambda e: open_url(URL_DONATE))
@ -2406,7 +2406,7 @@ def AboutTab(root, language_code):
lbl_release = Label(frame_group_header, text=translate[language_code]['release']) lbl_release = Label(frame_group_header, text=translate[language_code]['release'])
lbl_release.grid(column=0, row=group_row_count, sticky = E) lbl_release.grid(column=0, row=group_row_count, sticky = E)
lbl_release_url = Label(frame_group_header, text=URL_RELEASE, fg="blue", cursor="hand2") lbl_release_url = Label(frame_group_header, text=URL_RELEASE, fg="blue", bg="gray", cursor="hand2")
lbl_release_url.grid(column=1, row=group_row_count, sticky = W) lbl_release_url.grid(column=1, row=group_row_count, sticky = W)
lbl_release_url.bind("<Button-1>", lambda e: open_url(URL_RELEASE)) lbl_release_url.bind("<Button-1>", lambda e: open_url(URL_RELEASE))
@ -2415,7 +2415,7 @@ def AboutTab(root, language_code):
lbl_fb_fans = Label(frame_group_header, text=u'Facebook') lbl_fb_fans = Label(frame_group_header, text=u'Facebook')
lbl_fb_fans.grid(column=0, row=group_row_count, sticky = E) lbl_fb_fans.grid(column=0, row=group_row_count, sticky = E)
lbl_fb_fans_url = Label(frame_group_header, text=URL_FB, fg="blue", cursor="hand2") lbl_fb_fans_url = Label(frame_group_header, text=URL_FB, fg="blue", bg="gray", cursor="hand2")
lbl_fb_fans_url.grid(column=1, row=group_row_count, sticky = W) lbl_fb_fans_url.grid(column=1, row=group_row_count, sticky = W)
lbl_fb_fans_url.bind("<Button-1>", lambda e: open_url(URL_FB)) lbl_fb_fans_url.bind("<Button-1>", lambda e: open_url(URL_FB))
@ -2425,7 +2425,7 @@ def AboutTab(root, language_code):
lbl_chrome_driver = Label(frame_group_header, text=u'Chrome Driver') lbl_chrome_driver = Label(frame_group_header, text=u'Chrome Driver')
lbl_chrome_driver.grid(column=0, row=group_row_count, sticky = E) lbl_chrome_driver.grid(column=0, row=group_row_count, sticky = E)
lbl_chrome_driver_url = Label(frame_group_header, text=URL_CHROME_DRIVER, fg="blue", cursor="hand2") lbl_chrome_driver_url = Label(frame_group_header, text=URL_CHROME_DRIVER, fg="blue", bg="gray", cursor="hand2")
lbl_chrome_driver_url.grid(column=1, row=group_row_count, sticky = W) lbl_chrome_driver_url.grid(column=1, row=group_row_count, sticky = W)
lbl_chrome_driver_url.bind("<Button-1>", lambda e: open_url(URL_CHROME_DRIVER)) lbl_chrome_driver_url.bind("<Button-1>", lambda e: open_url(URL_CHROME_DRIVER))
@ -2434,7 +2434,7 @@ def AboutTab(root, language_code):
lbl_firefox_driver = Label(frame_group_header, text=u'Firefox Driver') lbl_firefox_driver = Label(frame_group_header, text=u'Firefox Driver')
lbl_firefox_driver.grid(column=0, row=group_row_count, sticky = E) lbl_firefox_driver.grid(column=0, row=group_row_count, sticky = E)
lbl_firefox_driver_url = Label(frame_group_header, text=URL_FIREFOX_DRIVER, fg="blue", cursor="hand2") lbl_firefox_driver_url = Label(frame_group_header, text=URL_FIREFOX_DRIVER, fg="blue", bg="gray", cursor="hand2")
lbl_firefox_driver_url.grid(column=1, row=group_row_count, sticky = W) lbl_firefox_driver_url.grid(column=1, row=group_row_count, sticky = W)
lbl_firefox_driver_url.bind("<Button-1>", lambda e: open_url(URL_FIREFOX_DRIVER)) lbl_firefox_driver_url.bind("<Button-1>", lambda e: open_url(URL_FIREFOX_DRIVER))
@ -2443,7 +2443,7 @@ def AboutTab(root, language_code):
lbl_edge_driver = Label(frame_group_header, text=u'Edge Driver') lbl_edge_driver = Label(frame_group_header, text=u'Edge Driver')
lbl_edge_driver.grid(column=0, row=group_row_count, sticky = E) lbl_edge_driver.grid(column=0, row=group_row_count, sticky = E)
lbl_edge_driver_url = Label(frame_group_header, text=URL_EDGE_DRIVER, fg="blue", cursor="hand2") lbl_edge_driver_url = Label(frame_group_header, text=URL_EDGE_DRIVER, fg="blue", bg="gray", cursor="hand2")
lbl_edge_driver_url.grid(column=1, row=group_row_count, sticky = W) lbl_edge_driver_url.grid(column=1, row=group_row_count, sticky = W)
lbl_edge_driver_url.bind("<Button-1>", lambda e: open_url(URL_EDGE_DRIVER)) lbl_edge_driver_url.bind("<Button-1>", lambda e: open_url(URL_EDGE_DRIVER))

View File

@ -28,7 +28,7 @@ import asyncio
import tornado import tornado
from tornado.web import Application from tornado.web import Application
CONST_APP_VERSION = "MaxBot (2023.08.16)" CONST_APP_VERSION = "MaxBot (2023.08.17)"
CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt" CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt"