fix: follow site drift (VoteBridgeNew .jsp→.xhtml and btnSubmit CSS scope) (#115)#116
Open
nishimaki wants to merge 2 commits intohmasdev:mainfrom
Open
fix: follow site drift (VoteBridgeNew .jsp→.xhtml and btnSubmit CSS scope) (#115)#116nishimaki wants to merge 2 commits intohmasdev:mainfrom
nishimaki wants to merge 2 commits intohmasdev:mainfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two independent drifts that break the entire voting flow against
the current live site. Details and reproduction are in #115.
VoteBridgeNew.jsp→VoteBridgeNew.xhtml(
get_bet_limit/ login redirected to the SP error page).pyjpboatrace/const.py, 1 line.By.CLASS_NAME, 'btnSubmit'is ambiguous on the currentDOM (matches hidden password-change forms first). Scoped to
By.CSS_SELECTOR, '.inputCompletion .btnSubmit a'and added aWebDriverWaitfor the confirmation page'sid=pass.pyjpboatrace/operator/better.py, 9/-3.Both commits are independently reviewable.
Test plan
get_bet_limit()returns the correct numeric balance on the livesite (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.
better.pytests 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 Irely 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.
.inputCompletion .btnSubmit ais strictly more specific than.btnSubmitand should still match the intended button, while theWebDriverWaitonly adds a few milliseconds on the happy path.Closes #115