Mixed Chromedriver
mixed_chromedriver is a flexible Chrome driver wrapper that extends Selenium, Selenium Wire, and Undetected Chromedriver. It enhances browser automation by providing convenient methods for common interactions and a Selector object that simplifies element selection for users unfamiliar with CSS selectors and XPath.
Features
🖥️ Flexible Chrome Driver Initialization
Supports multiple driver types:
- Original (Standard Selenium WebDriver)
- Wire (Selenium Wire for capturing and modifying network requests)
- Undetected (Bypasses bot detection mechanisms)
- Wire & Undetected (Combines both for advanced use cases)
- Pre-configured with helpful arguments for better performance and stability
⚡ Enhanced Automation Methods
Convenient functions for interacting with web elements:
wait_element– Waits for an element to appearclick– Clicks on an elementsend_keys– Sends keystrokes to an input fieldselect_option– Selects an option from a dropdownkeystroke– Simulates keyboard input
🏷️ CSS & XPath Selector Generator
Easily generate selectors using the Selector object:
- CSS – Automatically construct valid CSS selectors
- XPath – Generate precise XPath expressions
Installation
Install the package using pip:
PyPI:
pip install mixed-chromedriver
GitHub:
pip install git+https://github.com/tranngocminhhieu/mixed-chromedriver.git
User Manual
🚀 Quick Start
from mixed_chromedriver import Driver, Selector
from selenium.webdriver.common.keys import Keys
driver = Driver(undetected=True)
driver.get('https://getbootstrap.com/') # Open URL
driver.click(Selector(tag='span', contains='Search')) # Click the search bar with `contains`
driver.send_keys(Selector(Id='docsearch-input'), value='select') # Type "select"
driver.click(Selector(tag='span', class_='DocSearch-Hit-title', contains='Default'))
# Test select_option
default_select = Selector(tag='select', attrs={'aria-label': 'Default select example'}) # Create selector for reuse
driver.select_option(default_select, option='One')
driver.select_option(default_select, option='2', method='value')
driver.select_option(default_select, option=3, method='index')
# Test keystroke
driver.keystroke(Keys.SPACE) # Scroll down
driver.keystroke(Keys.SHIFT, Keys.SPACE) # Scroll up
🌐 Chrome Driver Usage
from mixed_chromedriver import Driver
driver = Driver(headless=False, wire=False, undetected=False, options=None, service=None, user_data_dir=None, profile_directory=None)
Chrome Initialization Parameters:
headless: Use headless browser.wire: Use selenium-wire to work with requests.undetected: Use undetected-chromedriver to avoid anti bot.options: Options object.service: Service object.user_data_dir: User data directory.profile_directory: Profile directory.
🔍 Selector Object
The Selector object simplifies element selection by auto-generating CSS and XPath selectors.
Example Usage:
from mixed_chromedriver import Selector
selector = Selector(tag='input', attrs={'name':'email'})
print(selector.css) # Output: input[name="email"]
print(selector.xpath) # Output: //input[@name="email"]
Selector Parameters:
tag: The HTML tag to select (default is"*").Id: The ID attribute of the element.class_: The class name to match.not_class: Excludes elements with this class.contains: Matches elements containing this text.attrs: Dictionary of attributes to match (e.g.,{"name": "value"}).not_attrs: List of attributes that must not be present.starts_with: Dictionary of attributes that must start with a value.ends_with: Dictionary of attributes that must end with a value.nth_child: Selects the nth child of its parent.last_child: If True, selects only the last child.direct_parent: Selects elements with this direct parent.any_parent: Selects elements with this parent at any level.
The Birth of mixed_chromedriver
For a while, I enjoyed using SeleniumBase—a powerful library that extends Selenium Wire and Undetected Chromedriver, offering many convenient methods for browser interaction. However, I soon encountered several challenges that were difficult to overcome:
- Limited customization – Adjusting driver options beyond the predefined keyword arguments was cumbersome.
- Connection issues – Certain websites triggered an ERR_CONNECTION_RESET error, even when using the
ucorwirearguments, while runningselenium-wireorundetected_chromedriverdirectly worked just fine. - Missing essential methods – Some key functionalities I needed were not available within the library.
Given my specific needs, I realized that I didn’t require a bulky framework like SeleniumBase. Instead, I decided to build a lightweight, highly customizable library with additional methods to simplify fundamental browser interactions.
Thus, mixed_chromedriver was born—a flexible solution for effortless browser automation. 🚀
Metadata
Release files for mixed-chromedriver 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mixed_chromedriver-0.3-py3-none-any.whl | Python 3 | none | any | Details |
Release files / mixed_chromedriver-0.3-py3-none-any.whl
| Download URL | mixed_chromedriver-0.3-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1be8a055e30d75a651d663f6bc5655f7651f746bc6ad9228e01d4c8ea18873c4
|
|
BLAKE2b-256 checksum How to use checksums |
fe22bbf4a297adc69922197c7619a4988ddda697d5426bba8bc4a49d76451843
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.5
|