Skip to content

Commit 89a704d

Browse files
Fix JavaScript selectors to use querySelectorAll for better browser compatibility
Co-Authored-By: Alek Petuskey <[email protected]>
1 parent 17863cb commit 89a704d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/test_chaining_event.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ def test_handler_from_handler(
3232
expect(run_button).to_be_visible()
3333

3434
page.evaluate("""() => {
35-
const button = document.querySelector('button[data-accent-color]:has-text("Run")');
36-
if (button) button.click();
35+
const buttons = document.querySelectorAll('button[data-accent-color]');
36+
for (const button of buttons) {
37+
if (button.textContent.includes('Run')) {
38+
button.click();
39+
break;
40+
}
41+
}
3742
}""")
3843

3944
expect(chain_heading).to_have_text("10", timeout=15000)
@@ -51,8 +56,10 @@ def test_collatz(reflex_web_app: AppHarness, page: Page, chaining_event_url):
5156
collatz_input.fill("10")
5257

5358
page.evaluate("""() => {
54-
const input = document.querySelector('#collatz input');
55-
if (input) input.blur();
59+
const inputs = document.querySelectorAll('#collatz input');
60+
if (inputs && inputs.length > 0) {
61+
inputs[0].blur();
62+
}
5663
}""")
5764

5865
collatz_heading = page.locator('[id="collatz"] > .rt-Flex > span')

0 commit comments

Comments
 (0)