Skip to content

Commit 00799d4

Browse files
committed
Python 2 and Selenium 4 fixes
1 parent 58bb3b5 commit 00799d4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

utest/test/keywords/test_webdrivercreator_executable_path.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import inspect
12
import os
3+
import unittest
24

35
import pytest
46
from mockito import mock, unstub, when, ANY
@@ -158,15 +160,29 @@ def test_create_ie_executable_path_not_set(creator):
158160
def test_create_edge_executable_path_set(creator):
159161
executable_path = '/path/to/MicrosoftWebDriver.exe'
160162
expected_webdriver = mock()
163+
when(creator)._has_options(ANY).thenReturn(False)
161164
when(webdriver).Edge(service_log_path=None,
162165
executable_path=executable_path).thenReturn(expected_webdriver)
163166
driver = creator.create_edge({}, None, executable_path=executable_path)
164167
assert driver == expected_webdriver
165168

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+
166181
def test_create_edge_executable_path_not_set(creator):
167182
executable_path = 'MicrosoftWebDriver.exe'
168183
expected_webdriver = mock()
169184
when(creator)._get_executable_path(ANY).thenReturn(executable_path)
185+
when(creator)._has_options(ANY).thenReturn(False)
170186
when(webdriver).Edge(service_log_path=None,
171187
executable_path=executable_path).thenReturn(expected_webdriver)
172188
driver = creator.create_edge({}, None, executable_path=None)

0 commit comments

Comments
 (0)