Skip to content

Commit

Permalink
2024-03-15, update for kktix
Browse files Browse the repository at this point in the history
  • Loading branch information
hahamic committed Mar 30, 2024
1 parent f3c8bbb commit 3c5fba7
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 40 deletions.
48 changes: 17 additions & 31 deletions chrome_tixcraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
print(exc)
pass

CONST_APP_VERSION = "MaxBot (2024.03.14)"
CONST_APP_VERSION = "MaxBot (2024.03.15)"

CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
Expand Down Expand Up @@ -3595,43 +3595,26 @@ def kktix_events_press_next_button(driver):
def kktix_press_next_button(driver):
ret = False

wait = WebDriverWait(driver, 1)
next_step_button = None
css_select = "div.register-new-next-button-area > button"
but_button_list = None
try:
# method #1
#form_actions_div = None
#form_actions_div = driver.find_element(By.CSS_SELECTOR, '#registrationsNewApp')
#next_step_button = form_actions_div.find_element(By.CSS_SELECTOR, 'div.form-actions button.btn-primary')

# method #2
# next_step_button = driver.find_element(By.CSS_SELECTOR, '#registrationsNewApp div.form-actions button.btn-primary')

# method #3 wait
next_step_button = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#registrationsNewApp div.form-actions button.btn-primary')))
if not next_step_button is None:
if next_step_button.is_enabled():
next_step_button.click()
ret = True

but_button_list = driver.find_elements(By.CSS_SELECTOR, css_select)
except Exception as exc:
print("wait form-actions div wait to be clickable Exception:")
print(exc)
#pass
pass

if not next_step_button is None:
is_visible = False
if not but_button_list is None:
button_count = len(but_button_list)
#print("button_count:",button_count)
if button_count > 0:
try:
if next_step_button.is_enabled():
is_visible = True
#print("click on last button")
but_button_list[button_count-1].click()
ret = True
except Exception as exc:
print(exc)
pass

if is_visible:
try:
driver.execute_script("arguments[0].click();", next_step_button)
ret = True
except Exception as exc:
pass
return ret

def kktix_captcha_inputed_text(captcha_inner_div):
Expand Down Expand Up @@ -4643,11 +4626,14 @@ def kktix_reg_captcha(driver, config_dict, fail_list, is_finish_checkbox_click,

# PS: auto-focus() when empty inferred_answer_string with empty inputed text value.
input_text_css = 'div.custom-captcha-inner > div > div > input'
next_step_button_css = '#registrationsNewApp div.form-actions button.btn-primary'
next_step_button_css = ''
submit_by_enter = False
check_input_interval = 0.2
is_answer_sent, fail_list = fill_common_verify_form(driver, config_dict, inferred_answer_string, fail_list, input_text_css, next_step_button_css, submit_by_enter, check_input_interval)

# due multi next buttons(pick seats/best seats)
kktix_press_next_button(driver)

return fail_list, is_question_popup

def kktix_reg_new_main(driver, config_dict, fail_list, played_sound_ticket, is_finish_checkbox_click):
Expand Down
2 changes: 1 addition & 1 deletion config_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import threading
import webbrowser

CONST_APP_VERSION = "MaxBot (2024.03.14)"
CONST_APP_VERSION = "MaxBot (2024.03.15)"

CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
Expand Down
2 changes: 1 addition & 1 deletion kktix_signout.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import asyncio
import nodriver as uc

CONST_APP_VERSION = "MaxBot (2024.03.14)"
CONST_APP_VERSION = "MaxBot (2024.03.15)"

CONST_MAXBOT_CONFIG_FILE = "settings.json"
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
Expand Down
2 changes: 1 addition & 1 deletion kktix_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import requests

CONST_APP_VERSION = "MaxBot (2024.03.14)"
CONST_APP_VERSION = "MaxBot (2024.03.15)"

CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json"
Expand Down
4 changes: 2 additions & 2 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
except Exception as exc:
pass

CONST_APP_VERSION = "MaxBot (2024.03.14)"
CONST_APP_VERSION = "MaxBot (2024.03.15)"

CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
Expand Down Expand Up @@ -759,7 +759,7 @@ def get_default_config():

config_dict["advanced"]["auto_reload_page_interval"] = 0.1
config_dict["advanced"]["reset_browser_interval"] = 0
config_dict["advanced"]["max_dwell_time"] = 30
config_dict["advanced"]["max_dwell_time"] = 60
config_dict["advanced"]["proxy_server_port"] = ""
config_dict["advanced"]["window_size"] = "512,1024"

Expand Down
10 changes: 8 additions & 2 deletions webdriver/Maxbotplus_1.0.0/js/kktix_registrations_assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ function kktix_area_keyword(settings, base_info, register_info)

if(auto_click_next_btn) {
let $next_btn = $('div.register-new-next-button-area > button');
$next_btn.click();
if($next_btn) {
if($next_btn.length>1) {
$next_btn.last().click();
} else {
$next_btn.click();
}
}
}
}
}
Expand Down Expand Up @@ -191,7 +197,7 @@ function dom_ready()
if(!dom_ready()) {
myInterval = setInterval(() => {
dom_ready();
}, 100);
}, 1000);
}


3 changes: 1 addition & 2 deletions webdriver/Maxbotplus_1.0.0/js/kktix_registrations_reload.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,10 @@ function kktix_force_auto_reload_by_timer()
{
if(settings) {
//console.log("auto reload for kktix");
// TODO: load from settings.advanced.max_dwell_time
if(settings.advanced.kktix_account.length > 0) {
setInterval(() => {
location.reload();;
}, 30 * 1000);
}, 45 * 1000);
}
}
}
Expand Down

0 comments on commit 3c5fba7

Please sign in to comment.