@@ -49,11 +49,12 @@ def test_profile(testdir, httpserver):
4949 file_test = testdir .makepyfile (
5050 """
5151 import pytest
52+ from selenium.webdriver.common.by import By
5253 @pytest.mark.nondestructive
5354 def test_profile(base_url, selenium):
5455 selenium.get(base_url)
55- header = selenium.find_element_by_tag_name( 'h1')
56- anchor = selenium.find_element_by_tag_name( 'a')
56+ header = selenium.find_element(By.TAG_NAME, 'h1')
57+ anchor = selenium.find_element(By.TAG_NAME, 'a')
5758 header_color = header.value_of_css_property('color')
5859 anchor_color = anchor.value_of_css_property('color')
5960 assert header_color == 'rgb(255, 0, 0)'
@@ -81,11 +82,12 @@ def test_profile_with_preferences(testdir, httpserver):
8182 file_test = testdir .makepyfile (
8283 """
8384 import pytest
85+ from selenium.webdriver.common.by import By
8486 @pytest.mark.nondestructive
8587 def test_preferences(base_url, selenium):
8688 selenium.get(base_url)
87- header = selenium.find_element_by_tag_name( 'h1')
88- anchor = selenium.find_element_by_tag_name( 'a')
89+ header = selenium.find_element(By.TAG_NAME, 'h1')
90+ anchor = selenium.find_element(By.TAG_NAME, 'a')
8991 header_color = header.value_of_css_property('color')
9092 anchor_color = anchor.value_of_css_property('color')
9193 assert header_color == 'rgb(255, 0, 0)'
@@ -114,6 +116,7 @@ def test_extension(testdir):
114116 """
115117 import time
116118 import pytest
119+ from selenium.webdriver.common.by import By
117120 from selenium.common.exceptions import StaleElementReferenceException
118121 from selenium.webdriver.support.ui import WebDriverWait
119122 @pytest.mark.nondestructive
@@ -122,7 +125,7 @@ def test_extension(selenium):
122125 extensions = WebDriverWait(
123126 selenium, timeout=10,
124127 ignored_exceptions=StaleElementReferenceException).until(
125- lambda s: s.find_element_by_id(
128+ lambda s: s.find_element(By.ID,
126129 'extensions-tbody').text)
127130 assert 'Test Extension (empty)' in extensions
128131 """
@@ -136,15 +139,16 @@ def test_preferences_marker(testdir, httpserver):
136139 file_test = testdir .makepyfile (
137140 """
138141 import pytest
142+ from selenium.webdriver.common.by import By
139143 @pytest.mark.nondestructive
140144 @pytest.mark.firefox_preferences({
141145 'browser.anchor_color': '#FF69B4',
142146 'browser.display.foreground_color': '#FF0000',
143147 'browser.display.use_document_colors': False})
144148 def test_preferences(base_url, selenium):
145149 selenium.get(base_url)
146- header = selenium.find_element_by_tag_name( 'h1')
147- anchor = selenium.find_element_by_tag_name( 'a')
150+ header = selenium.find_element(By.TAG_NAME, 'h1')
151+ anchor = selenium.find_element(By.TAG_NAME, 'a')
148152 header_color = header.value_of_css_property('color')
149153 anchor_color = anchor.value_of_css_property('color')
150154 assert header_color == 'rgb(255, 0, 0)'
0 commit comments