Skip to content

Commit 4503b1e

Browse files
committed
Support using custom element classes
1 parent 845fa18 commit 4503b1e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

py/selenium/webdriver/remote/webdriver.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ def __init__(
173173
file_detector: Optional[FileDetector] = None,
174174
options: Optional[Union[BaseOptions, List[BaseOptions]]] = None,
175175
locator_converter: Optional[LocatorConverter] = None,
176+
web_element_cls: Optional[type] = None,
176177
) -> None:
177178
"""Create a new driver that will issue commands using the wire
178179
protocol.
@@ -185,10 +186,9 @@ def __init__(
185186
- file_detector - Pass custom file detector object during instantiation. If None,
186187
then default LocalFileDetector() will be used.
187188
- options - instance of a driver options.Options class
189+
- web_element_cls - Custom class to use for web elements. Defaults to WebElement.
188190
"""
189191

190-
self.locator_converter = locator_converter or LocatorConverter()
191-
192192
if isinstance(options, list):
193193
capabilities = create_matches(options)
194194
_ignore_local_proxy = False
@@ -211,6 +211,8 @@ def __init__(
211211
self._switch_to = SwitchTo(self)
212212
self._mobile = Mobile(self)
213213
self.file_detector = file_detector or LocalFileDetector()
214+
self.locator_converter = locator_converter or LocatorConverter()
215+
self._web_element_cls = web_element_cls or self._web_element_cls
214216
self._authenticator_id = None
215217
self.start_client()
216218
self.start_session(capabilities)

0 commit comments

Comments
 (0)