Skip to content

Commit 8367545

Browse files
committed
Revert "Try new approach getting to next cell for chome and firefox"
This reverts commit 3bcfed6.
1 parent 3bcfed6 commit 8367545

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

scripts/automated-notebook-run-script.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,24 @@ def main():
126126

127127
if cell_is_waiting_for_input(driver):
128128
print("Cell requesting input")
129-
input_box = WebDriverWait(driver, 5).until(
130-
EC.visibility_of_element_located((By.CSS_SELECTOR, ".jp-Stdin-input"))
131-
)
132-
input_box.click()
133-
input_box.send_keys("Test_Name")
134-
time.sleep(10)
135-
input_box.send_keys(Keys.CONTROL, Keys.ENTER)
136-
next_cell = focused_cell.find_element(
137-
By.XPATH, "following-sibling::div[contains(@class,'jp-Notebook-cell')][1]"
138-
)
139-
driver.execute_script("arguments[0].scrollIntoView({block:'center'});", next_cell)
129+
actions.send_keys("Test_Name").perform()
130+
time.sleep(0.75)
131+
actions.send_keys(Keys.CONTROL, Keys.ENTER)
132+
time.sleep(0.75)
133+
actions.move_to_element(focused_cell).perform()
134+
time.sleep(0.75)
135+
driver.execute_script("""
136+
var el = document.activeElement;
137+
var evt = new KeyboardEvent('keydown', {
138+
key: 'ArrowDown',
139+
code: 'ArrowDown',
140+
keyCode: 40,
141+
which: 40,
142+
bubbles: true
143+
});
144+
el.dispatchEvent(evt);
145+
""")
146+
time.sleep(0.75)
140147
os_name = platform.system()
141148

142149
if os_name == "Darwin":

0 commit comments

Comments
 (0)