-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly format file using docformatter, black, isort. Ensure PEP compliancy using flake8 Signed-off-by: Lionel Hubaut <lionel.hubaut@tessares.net>
- Loading branch information
Showing
9 changed files
with
273 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,46 @@ | ||
""" | ||
browser is the module handling the different browser logic and their | ||
implementation in order to be used with selenium. | ||
""" | ||
"""Browser is the module handling the different browser logic and their | ||
implementation in order to be used with selenium.""" | ||
|
||
import abc | ||
|
||
from selenium.webdriver.remote.webdriver import WebDriver | ||
|
||
|
||
class BrowserInterface(metaclass=abc.ABCMeta): | ||
"""BrowserInterface is a generic interface each browser subclass will need | ||
to implement in order to correctly configure the selenium webdriver. | ||
This interface ensures that all subclasses provide a specific method | ||
to load and configure a Selenium WebDriver instance appropriate for | ||
the browser they represent. | ||
""" | ||
BrowserInterface is a generic interface each browser subclass will need to | ||
implement in order to correctly configure the selenium webdriver. This interface | ||
ensures that all subclasses provide a specific method to load and configure | ||
a Selenium WebDriver instance appropriate for the browser they represent. | ||
""" | ||
|
||
@classmethod | ||
def __subclasshook__(cls, subclass): | ||
return (hasattr(subclass, 'load_driver') and | ||
callable(subclass.load_driver) or | ||
NotImplemented) | ||
return ( | ||
hasattr(subclass, "load_driver") | ||
and callable(subclass.load_driver) | ||
or NotImplemented | ||
) | ||
|
||
@classmethod | ||
@abc.abstractmethod | ||
def load_driver(cls) -> WebDriver: | ||
""" | ||
Loads and returns a configured instance of Selenium WebDriver specific to the browser. | ||
"""Loads and returns a configured instance of Selenium WebDriver | ||
specific to the browser. | ||
This method must be implemented by subclasses to provide a | ||
ready-to-use WebDriver instance that is appropriately configured | ||
for the browser the subclass represents. The configuration may | ||
include setting browser options, capabilities, and webdriver | ||
paths. | ||
This method must be implemented by subclasses to provide a ready-to-use WebDriver | ||
instance that is appropriately configured for the browser the subclass represents. | ||
The configuration may include setting browser options, capabilities, and webdriver paths. | ||
Returns: WebDriver: An instance of a Selenium WebDriver | ||
ready for browser automation tasks. | ||
Returns: | ||
WebDriver: An instance of a Selenium WebDriver ready for browser automation tasks. | ||
Raises: NotImplementedError: If the subclass does not | ||
implement this method. | ||
Raises: | ||
NotImplementedError: If the subclass does not implement this method. | ||
""" | ||
raise NotImplementedError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.