|
| 1 | +import inspect |
1 | 2 | import os |
| 3 | +import unittest |
2 | 4 |
|
3 | 5 | import pytest |
4 | 6 | from mockito import mock, unstub, when, ANY |
@@ -158,15 +160,29 @@ def test_create_ie_executable_path_not_set(creator): |
158 | 160 | def test_create_edge_executable_path_set(creator): |
159 | 161 | executable_path = '/path/to/MicrosoftWebDriver.exe' |
160 | 162 | expected_webdriver = mock() |
| 163 | + when(creator)._has_options(ANY).thenReturn(False) |
161 | 164 | when(webdriver).Edge(service_log_path=None, |
162 | 165 | executable_path=executable_path).thenReturn(expected_webdriver) |
163 | 166 | driver = creator.create_edge({}, None, executable_path=executable_path) |
164 | 167 | assert driver == expected_webdriver |
165 | 168 |
|
| 169 | + |
| 170 | +@unittest.skipIf('options' not in inspect.getargspec(webdriver.Edge.__init__), "Requires Selenium 4.0.") |
| 171 | +def test_create_edge_executable_path_set_selenium_4(creator): |
| 172 | + executable_path = '/path/to/MicrosoftWebDriver.exe' |
| 173 | + expected_webdriver = mock() |
| 174 | + when(creator)._has_options(ANY).thenReturn(True) |
| 175 | + when(webdriver).Edge(service_log_path=None, |
| 176 | + executable_path=executable_path).thenReturn(expected_webdriver) |
| 177 | + driver = creator.create_edge({}, None, executable_path=executable_path) |
| 178 | + assert driver == expected_webdriver |
| 179 | + |
| 180 | + |
166 | 181 | def test_create_edge_executable_path_not_set(creator): |
167 | 182 | executable_path = 'MicrosoftWebDriver.exe' |
168 | 183 | expected_webdriver = mock() |
169 | 184 | when(creator)._get_executable_path(ANY).thenReturn(executable_path) |
| 185 | + when(creator)._has_options(ANY).thenReturn(False) |
170 | 186 | when(webdriver).Edge(service_log_path=None, |
171 | 187 | executable_path=executable_path).thenReturn(expected_webdriver) |
172 | 188 | driver = creator.create_edge({}, None, executable_path=None) |
|
0 commit comments