Skip to content

fix: follow site drift (VoteBridgeNew .jsp→.xhtml and btnSubmit CSS scope) (#115)#116

Open
nishimaki wants to merge 2 commits intohmasdev:mainfrom
nishimaki:pr/site-drift
Open

fix: follow site drift (VoteBridgeNew .jsp→.xhtml and btnSubmit CSS scope) (#115)#116
nishimaki wants to merge 2 commits intohmasdev:mainfrom
nishimaki:pr/site-drift

Conversation

@nishimaki
Copy link
Copy Markdown

Summary

Fixes two independent drifts that break the entire voting flow against
the current live site. Details and reproduction are in #115.

  • Drift 1: VoteBridgeNew.jspVoteBridgeNew.xhtml
    (get_bet_limit / login redirected to the SP error page).
    pyjpboatrace/const.py, 1 line.
  • Drift 2: By.CLASS_NAME, 'btnSubmit' is ambiguous on the current
    DOM (matches hidden password-change forms first). Scoped to
    By.CSS_SELECTOR, '.inputCompletion .btnSubmit a' and added a
    WebDriverWait for the confirmation page's id=pass.
    pyjpboatrace/operator/better.py, 9/-3.

Both commits are independently reviewable.

Test plan

  • get_bet_limit() returns the correct numeric balance on the live
    site (verified twice: before and after deposit).
  • bet(stadium=14, race=11, trifecta_betting_dict={'1-2-3': 100})
    succeeds end-to-end against the live site, balance decreases by
    100 yen, and the bet appears in the official vote history.
  • Unit tests — not added here because the existing better.py
    tests appear to be Selenium integration tests. Happy to add
    mock-based unit tests for the new CSS selector in a follow-up
    commit if you prefer a specific style.

Notes

  • deposit() / withdraw() paths are not covered in this PR because I
    rely on manual web-UI deposits in my own operation. They may still
    work unchanged once Drift 1 is fixed, but I have not verified them.
  • No behavior change when the login URL / DOM revert: the CSS selector
    .inputCompletion .btnSubmit a is strictly more specific than
    .btnSubmit and should still match the intended button, while the
    WebDriverWait only adds a few milliseconds on the happy path.

Closes #115

boatrace.jp migrated the vote bridge endpoint from VoteBridgeNew.jsp
to VoteBridgeNew.xhtml (JSF). The old URL now redirects to a SP error
page (sp/ibm/sliphttp/signless.jsp), causing TimeoutException in
get_bet_limit() and the entire betting flow.

Verified with get_bet_limit() returning a numeric balance on the
real site. Login form, currentBetLimitAmount element, and PC flow
are otherwise unchanged.
The bare `By.CLASS_NAME, 'btnSubmit'` matched hidden `btnSubmit` elements
belonging to password-change sub-forms (`<li class="btn btnSubmit">`)
before the real "投票入力完了" button (`<div class="inputCompletion"><div class="btnSubmit">`).
As a result the vote flow silently failed to navigate to the
confirmation page, and the following `find_element(By.ID, 'pass')` raised
NoSuchElementException.

Fix:
- Use `By.CSS_SELECTOR, '.inputCompletion .btnSubmit a'` to target the
  correct button unambiguously.
- Wait for `id=pass` on the confirmation page with WebDriverWait to
  tolerate the navigation delay.

Verified against the live site with a real 100-yen trifecta bet: the
balance decreased by 100 yen and the bet appeared in the vote history.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Voting flow broken on current site (VoteBridgeNew.jsp 404 and btnSubmit selector collision)

1 participant