Skip to content

Commit e1ef766

Browse files
[py] fixed safari tests (#12533)
* [py] fixed safari tests * [py] modified message in xfail for safari tests
1 parent 73c38af commit e1ef766

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

py/test/selenium/webdriver/common/select_class_tests.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def test_select_by_index_single(driver, pages):
4848
assert sel.first_selected_option.text == select["values"][x]
4949

5050

51+
@pytest.mark.xfail_safari(reason="options incorrectly reported as enabled")
5152
def test_raises_exception_select_by_index_single_disabled(driver, pages):
5253
pages.load("formPage.html")
5354
sel = Select(driver.find_element(By.NAME, disabledSingleSelect["name"]))
@@ -64,6 +65,7 @@ def test_select_by_value_single(driver, pages):
6465
assert sel.first_selected_option.text == select["values"][x]
6566

6667

68+
@pytest.mark.xfail_safari(reason="options incorrectly reported as enabled")
6769
def test_raises_exception_select_by_value_single_disabled(driver, pages):
6870
pages.load("formPage.html")
6971
sel = Select(driver.find_element(By.NAME, disabledSingleSelect["name"]))
@@ -82,6 +84,7 @@ def test_select_by_visible_text_single(driver, pages):
8284
assert sel.first_selected_option.text == select["values"][x]
8385

8486

87+
@pytest.mark.xfail_safari(reason="options incorrectly reported as enabled")
8588
def test_raises_exception_select_by_text_single_disabled(driver, pages):
8689
pages.load("formPage.html")
8790
sel = Select(driver.find_element(By.NAME, disabledSingleSelect["name"]))
@@ -103,6 +106,7 @@ def test_select_by_index_multiple(driver, pages):
103106
assert selected[j].text == select["values"][j]
104107

105108

109+
@pytest.mark.xfail_safari(reason="options incorrectly reported as enabled")
106110
def test_raises_exception_select_by_index_multiple_disabled(driver, pages):
107111
pages.load("formPage.html")
108112

@@ -125,6 +129,7 @@ def test_select_by_value_multiple(driver, pages):
125129
assert selected[j].text == select["values"][j]
126130

127131

132+
@pytest.mark.xfail_safari(reason="options incorrectly reported as enabled")
128133
def test_raises_exception_select_by_value_multiple_disabled(driver, pages):
129134
pages.load("formPage.html")
130135

@@ -147,6 +152,7 @@ def test_select_by_visible_text_multiple(driver, pages):
147152
assert selected[j].text == select["values"][j]
148153

149154

155+
@pytest.mark.xfail_safari(reason="options incorrectly reported as enabled")
150156
def test_raises_exception_select_by_text_multiple_disabled(driver, pages):
151157
pages.load("formPage.html")
152158

py/test/selenium/webdriver/safari/launcher_tests.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
import pytest
2121

22+
from selenium.common.exceptions import NoSuchDriverException
23+
from selenium.webdriver.safari.service import Service
24+
2225

2326
def test_launch(driver):
2427
assert driver.capabilities["browserName"] == "Safari"
@@ -27,9 +30,9 @@ def test_launch(driver):
2730
def test_launch_with_invalid_executable_path_raises_exception(driver_class):
2831
path = "/this/path/should/never/exist"
2932
assert not os.path.exists(path)
30-
with pytest.raises(Exception) as e:
31-
driver_class(executable_path=path)
32-
assert "are you running Safari 10 or later?" in str(e)
33+
service = Service(executable_path=path)
34+
with pytest.raises(NoSuchDriverException):
35+
driver_class(service=service)
3336

3437

3538
@pytest.mark.skipif(

0 commit comments

Comments
 (0)