Compare commits
No commits in common. "118bd2659082ef23afef3d9825e5df5305d05d52" and "3c11d609f5494d669116b9f86030b4f11b4e96f5" have entirely different histories.
118bd26590
...
3c11d609f5
4 changed files with 11 additions and 13 deletions
|
|
@ -9,8 +9,7 @@ https://github.com/user-attachments/assets/e81d8dfb-578f-4a79-9989-210164fc0148
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- **Multi-platform support**: AtCoder, CodeChef, Codeforces, USACO, CSES,
|
- **Multi-platform support**: AtCoder, CodeChef, Codeforces, and CSES
|
||||||
Kattis
|
|
||||||
- **Automatic problem setup**: Scrape test cases and metadata in seconds
|
- **Automatic problem setup**: Scrape test cases and metadata in seconds
|
||||||
- **Dual view modes**: Lightweight I/O view for quick feedback, full panel for
|
- **Dual view modes**: Lightweight I/O view for quick feedback, full panel for
|
||||||
detailed analysis
|
detailed analysis
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ from .timeouts import (
|
||||||
BROWSER_ELEMENT_WAIT,
|
BROWSER_ELEMENT_WAIT,
|
||||||
BROWSER_NAV_TIMEOUT,
|
BROWSER_NAV_TIMEOUT,
|
||||||
BROWSER_SESSION_TIMEOUT,
|
BROWSER_SESSION_TIMEOUT,
|
||||||
|
BROWSER_SETTLE_DELAY,
|
||||||
BROWSER_SUBMIT_NAV_TIMEOUT,
|
BROWSER_SUBMIT_NAV_TIMEOUT,
|
||||||
BROWSER_TURNSTILE_POLL,
|
BROWSER_TURNSTILE_POLL,
|
||||||
HTTP_TIMEOUT,
|
HTTP_TIMEOUT,
|
||||||
|
|
@ -499,6 +500,7 @@ def _submit_headless(
|
||||||
"buffer": Path(file_path).read_bytes(),
|
"buffer": Path(file_path).read_bytes(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
page.wait_for_timeout(BROWSER_SETTLE_DELAY)
|
||||||
page.locator('button[type="submit"]').click(no_wait_after=True)
|
page.locator('button[type="submit"]').click(no_wait_after=True)
|
||||||
page.wait_for_url(
|
page.wait_for_url(
|
||||||
lambda url: "/submissions/me" in url,
|
lambda url: "/submissions/me" in url,
|
||||||
|
|
|
||||||
|
|
@ -178,15 +178,16 @@ def _submit_headless_codechef(
|
||||||
needs_relogin = True
|
needs_relogin = True
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
page.wait_for_selector('[aria-haspopup="listbox"]', timeout=10000)
|
page.wait_for_timeout(2000)
|
||||||
|
|
||||||
page.locator('[aria-haspopup="listbox"]').click()
|
page.locator('[aria-haspopup="listbox"]').click()
|
||||||
page.wait_for_selector('[role="option"]', timeout=5000)
|
page.wait_for_selector('[role="option"]', timeout=5000)
|
||||||
page.locator(f'[role="option"][data-value="{language_id}"]').click()
|
page.locator(f'[role="option"][data-value="{language_id}"]').click()
|
||||||
page.wait_for_timeout(250)
|
page.wait_for_timeout(2000)
|
||||||
|
|
||||||
page.locator(".ace_editor").click()
|
page.locator(".ace_editor").click()
|
||||||
page.keyboard.press("Control+a")
|
page.keyboard.press("Control+a")
|
||||||
|
page.wait_for_timeout(200)
|
||||||
page.evaluate(
|
page.evaluate(
|
||||||
"""(code) => {
|
"""(code) => {
|
||||||
const textarea = document.querySelector('.ace_text-input');
|
const textarea = document.querySelector('.ace_text-input');
|
||||||
|
|
@ -198,25 +199,20 @@ def _submit_headless_codechef(
|
||||||
}""",
|
}""",
|
||||||
source_code,
|
source_code,
|
||||||
)
|
)
|
||||||
page.wait_for_timeout(125)
|
page.wait_for_timeout(1000)
|
||||||
|
|
||||||
page.evaluate(
|
page.evaluate(
|
||||||
"() => document.getElementById('submit_btn').scrollIntoView({block:'center'})"
|
"() => document.getElementById('submit_btn').scrollIntoView({block:'center'})"
|
||||||
)
|
)
|
||||||
|
page.wait_for_timeout(200)
|
||||||
page.locator("#submit_btn").dispatch_event("click")
|
page.locator("#submit_btn").dispatch_event("click")
|
||||||
try:
|
page.wait_for_timeout(3000)
|
||||||
page.wait_for_selector('[role="dialog"], .swal2-popup', timeout=5000)
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
dialog_text = page.evaluate("""() => {
|
dialog_text = page.evaluate("""() => {
|
||||||
const d = document.querySelector('[role="dialog"], .swal2-popup');
|
const d = document.querySelector('[role="dialog"], .swal2-popup');
|
||||||
return d ? d.textContent.trim() : null;
|
return d ? d.textContent.trim() : null;
|
||||||
}""")
|
}""")
|
||||||
if dialog_text and (
|
if dialog_text and "not available for accepting solutions" in dialog_text:
|
||||||
"not available for accepting solutions" in dialog_text
|
|
||||||
or "not available for submission" in dialog_text
|
|
||||||
):
|
|
||||||
submit_error = "PRACTICE_FALLBACK"
|
submit_error = "PRACTICE_FALLBACK"
|
||||||
elif dialog_text:
|
elif dialog_text:
|
||||||
submit_error = dialog_text
|
submit_error = dialog_text
|
||||||
|
|
|
||||||
|
|
@ -11,3 +11,4 @@ BROWSER_SUBMIT_NAV_TIMEOUT["atcoder"] = BROWSER_NAV_TIMEOUT * 2
|
||||||
BROWSER_SUBMIT_NAV_TIMEOUT["codeforces"] = BROWSER_NAV_TIMEOUT * 2
|
BROWSER_SUBMIT_NAV_TIMEOUT["codeforces"] = BROWSER_NAV_TIMEOUT * 2
|
||||||
BROWSER_TURNSTILE_POLL = 5000
|
BROWSER_TURNSTILE_POLL = 5000
|
||||||
BROWSER_ELEMENT_WAIT = 10000
|
BROWSER_ELEMENT_WAIT = 10000
|
||||||
|
BROWSER_SETTLE_DELAY = 500
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue