Merge pull request #3726 from takluyver/selenium-newnb-clickable

Wait for 'New' dropdown button to be clickable for Selenium tests
This commit is contained in:
Thomas Kluyver 2018-07-04 14:53:30 +02:00 committed by GitHub
commit 9d0ea1a427
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -61,7 +61,7 @@ data-server-root="{{server_root}}"
</span>
</form>
<div id="new-buttons" class="btn-group">
<button class="dropdown-toggle btn btn-default btn-xs" data-toggle="dropdown">
<button class="dropdown-toggle btn btn-default btn-xs" id="new-dropdown-button" data-toggle="dropdown">
<span>{% trans %}New{% endtrans %}</span>
<span class="caret"></span>
</button>

View File

@ -231,7 +231,8 @@ class Notebook:
def select_kernel(browser, kernel_name='kernel-python3'):
"""Clicks the "new" button and selects a kernel from the options.
"""
new_button = wait_for_selector(browser, "#new-buttons", single=True)
wait = WebDriverWait(browser, 10)
new_button = wait.until(EC.element_to_be_clickable((By.ID, "new-dropdown-button")))
new_button.click()
kernel_selector = '#{} a'.format(kernel_name)
kernel = wait_for_selector(browser, kernel_selector, single=True)