fix(codeforces): set source via JS to handle hidden CodeMirror textarea
This commit is contained in:
parent
458c8de119
commit
b5a8fce13c
1 changed files with 11 additions and 1 deletions
|
|
@ -379,7 +379,17 @@ def _submit_headless(
|
||||||
problem_id.upper(),
|
problem_id.upper(),
|
||||||
)
|
)
|
||||||
page.select_option('select[name="programTypeId"]', language_id)
|
page.select_option('select[name="programTypeId"]', language_id)
|
||||||
page.fill('textarea[name="source"]', source_code)
|
page.evaluate(
|
||||||
|
"""(code) => {
|
||||||
|
const cm = document.querySelector('.CodeMirror');
|
||||||
|
if (cm && cm.CodeMirror) {
|
||||||
|
cm.CodeMirror.setValue(code);
|
||||||
|
}
|
||||||
|
const ta = document.querySelector('textarea[name="source"]');
|
||||||
|
if (ta) ta.value = code;
|
||||||
|
}""",
|
||||||
|
source_code,
|
||||||
|
)
|
||||||
page.locator("form.submit-form input.submit").click(no_wait_after=True)
|
page.locator("form.submit-form input.submit").click(no_wait_after=True)
|
||||||
try:
|
try:
|
||||||
page.wait_for_url(
|
page.wait_for_url(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue