Reference
utils_seleniumxp ¶
Package with utilities and functional extensions for Selenium webdriver Python language bindings
The package consist of various helpers and extensions to the Selenium webdriver:
- module for session handling especially a custom factory function to initialize a webdriver object
- module with additional methods for the webdriver class
- module with convenience functions for locators
- module with additional methods for the webelement class
- an extended event-firing webdriver and an extended listener abstract base class
- a sample event listener implementation based on the extended abstract base class
Different from other packages extending the Selenium webdriver class does not work with wrapping the original webdriver but providing a mixin class or alternatively directly setting additional methods via 'setattr' in the original webdriver class. This is done and controlled via a pretty versatile custom factory function initializing the webdriver. The custom factory function offers a mechanism to browser-type specific initializations and settings with examples provided for enabling a direct download, disabling browser notifications or optimized scraping.
The webelement extension are done via setattr only. Implementing a mixin class would require to modify webdriver methods to return the new class with the mixin. So benefit of the settattr approach is that extending the webelement class is independend from changes to the webdriver class.
The package also provides an extended event-firing webdriver class.
This approach makes this package a full drop-in replacement for the original selenium driver. Beside the factory function to create the webdriver there is no change in the API.