Mixed Chrome driver for Selenium
Project description
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 Chrome, Selector
from selenium.webdriver.common.keys import Keys
driver = Chrome(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.wait_element(Selector(tag='div', class_='DocSearch-Hit-source'), visibility=True) # Wait results
driver.keystroke(Keys.CONTROL, Keys.ENTER) # Ctrl Enter: Open the first result in new tab
driver.switch_to.window(driver.window_handles[-1]) # Switch to the new tab
# 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')
🌐 Chrome Driver Usage
from mixed_chromedriver import Chrome
driver = Chrome(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. 🚀
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mixed_chromedriver-0.1-py3-none-any.whl.
File metadata
- Download URL: mixed_chromedriver-0.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91bd6a36a0509fcd1bdf3091e07af0580dab6fc222d9153b21d60eea1c4ca909
|
|
| MD5 |
15c3c6370deb9b684ec04b69b951e2cd
|
|
| BLAKE2b-256 |
176b2f97bf0642aa52d476467c9a6ecfa64736c9daf9a9e7ee67f42b256e5ac1
|