I'm running a Corona Jupyter notebook every day manually and want to automate this using Robot Framework.
Here is the code:
Library RPA.Browser.Selenium
# ...
${result1}= Open Using Run Dialog C:/Python/runJupyter.bat C:\\WINDOWS\\system32\\cmd.exe
Open Browser http://localhost:8888/?token=c08... chrome alias=chrome
Maximize Browser Window
Click Element //span[contains(text(), 'Corona')]
Sleep 1s
Click Element //span[contains(text(),"corona.ipynb")]
Sleep 3s
${handle}= Switch Window NEW # took me a while to find this
${title}= Get Title
Log ${title} # check if the right Tab is active
Pause Execution
# //*[contains(@id,"run_all_cells")] # error
# //a[contains(text(), 'Run All')] # also error
# //a[text()='Run All'] # also error
Click Element //*[contains(@id,"run_all_cells")] # error
Pause Execution
Finally I want to Run All
lines of the notebook. None of the xpath variants work even if I inspected the html code using chrome. The message I get is: Message: element not interactable
What is the right xpath for Run All
?
EDIT: The section of interest looks as follows:
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a>
<ul id="cell_menu" class="dropdown-menu">
<li id="run_cell" title="Run this cell, and move cursor to the next one">
<a href="#">Run Cells</a></li>
<li id="run_cell_select_below" title="Run this cell, select below">
<a href="#">Run Cells and Select Below</a></li>
<li id="run_cell_insert_below" title="Run this cell, insert below">
<a href="#">Run Cells and Insert Below</a></li>
<li id="run_all_cells" title="Run all cells in the notebook">
<a href="#">Run All</a></li>
<li id="run_all_cells_above" title="Run all cells above (but not including) this cell">
<a href="#">Run All Above</a></li>
<li id="run_all_cells_below" title="Run this cell and all cells below it">
<a href="#">Run All Below</a></li>
<li class="divider"></li>
CodePudding user response:
There is an additional step required to open the drop down menu with Click Element //a[text()='Cell']
before clicking the link element to "Run All"