Skip to content

Commit 3bcfed6

Browse files
committed
Try new approach getting to next cell for chome and firefox
1 parent 8dfb3b6 commit 3bcfed6

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

scripts/automated-notebook-run-script.py

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

127127
if cell_is_waiting_for_input(driver):
128128
print("Cell requesting input")
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)
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)
147140
os_name = platform.system()
148141

149142
if os_name == "Darwin":

0 commit comments

Comments
 (0)