|
3 | 3 | An object whose metadata contains an "isolated" tag must be isolated |
4 | 4 | from the rest of the document. |
5 | 5 | """ |
| 6 | + |
| 7 | +from selenium.webdriver.common.by import By |
| 8 | + |
6 | 9 | from .utils import wait_for_tag |
7 | 10 |
|
8 | 11 |
|
@@ -43,16 +46,16 @@ def isolated_html(notebook): |
43 | 46 | iframe = wait_for_tag(notebook.browser, "iframe", single=True) |
44 | 47 |
|
45 | 48 | # The non-isolated div will be in the body |
46 | | - non_isolated_div = notebook.body.find_element_by_id("non-isolated") |
| 49 | + non_isolated_div = notebook.body.find_element(By.ID, "non-isolated") |
47 | 50 | assert non_isolated_div.value_of_css_property("color") == red |
48 | 51 |
|
49 | 52 | # The non-isolated styling will have affected the output of other cells |
50 | | - test_div = notebook.body.find_element_by_id("test") |
| 53 | + test_div = notebook.body.find_element(By.ID, "test") |
51 | 54 | assert test_div.value_of_css_property("color") == red |
52 | 55 |
|
53 | 56 | # The isolated div will be in an iframe, only that element will be blue |
54 | 57 | notebook.browser.switch_to.frame(iframe) |
55 | | - isolated_div = notebook.browser.find_element_by_id("isolated") |
| 58 | + isolated_div = notebook.browser.find_element(By.ID, "isolated") |
56 | 59 | assert isolated_div.value_of_css_property("color") == blue |
57 | 60 | notebook.browser.switch_to.default_content() |
58 | 61 | # Clean up the html test cells |
@@ -80,13 +83,13 @@ def isolated_svg(notebook): |
80 | 83 |
|
81 | 84 | # The first rectangle will be red |
82 | 85 | notebook.browser.switch_to.frame(iframes[0]) |
83 | | - isolated_svg_1 = notebook.browser.find_element_by_id('r1') |
| 86 | + isolated_svg_1 = notebook.browser.find_element(By.ID, 'r1') |
84 | 87 | assert isolated_svg_1.value_of_css_property("fill") == yellow |
85 | 88 | notebook.browser.switch_to.default_content() |
86 | 89 |
|
87 | 90 | # The second rectangle will be black |
88 | 91 | notebook.browser.switch_to.frame(iframes[1]) |
89 | | - isolated_svg_2 = notebook.browser.find_element_by_id('r2') |
| 92 | + isolated_svg_2 = notebook.browser.find_element(By.ID, 'r2') |
90 | 93 | assert isolated_svg_2.value_of_css_property("fill") == black |
91 | 94 |
|
92 | 95 | # Clean up the svg test cells |
|
0 commit comments