Skip to main content

BrowserJQuery

A Python library that seamlessly integrates jQuery functionality with Selenium WebDriver. This library provides a convenient and powerful way to interact with web elements using jQuery selectors and methods in your Selenium tests, making web automation more intuitive and efficient.

Features

  • Use jQuery selectors to find elements
  • Chain jQuery methods for complex element interactions
  • Built-in support for common jQuery operations
  • Type-safe implementation with mypy support
  • Comprehensive test coverage

Installation

pip install browserjquery

For development, install with test dependencies:

pip install "browserjquery[dev]"

Quick Start

from selenium import webdriver
from browserjquery import BrowserJQuery

# Initialize the WebDriver
driver = webdriver.Chrome()

# Create a BrowserJQuery instance
jquery = BrowserJQuery(driver)

# Navigate to a page
driver.get("https://example.com")

# Find elements using jQuery selectors
elements = jquery.find("div.test-class")
first_element = jquery.find("div.test-class", first_match=True)

# Find elements containing specific text
elements_with_text = jquery.find_elements_with_text("Hello World")

# Check if an element has a specific class
has_class = jquery.has_class(element, "active")

# Get parent elements
parent = jquery.parent(element)
all_parents = jquery.parents(element)

# Find closest ancestor with specific selector
closest = jquery.find_closest_ancestor("div.container", element)

Advanced Usage

Chaining Methods

# Chain multiple jQuery operations
result = jquery.find("div.item").filter(".active").find("span").text()

Working with Forms

# Fill form fields
jquery.find("input[name='username']").val("testuser")
jquery.find("input[name='password']").val("password123")

# Submit form
jquery.find("form").submit()

Event Handling

# Attach event handlers
jquery.find("button").on("click", "alert('clicked!')")

Contributing

Contributions are welcome! Feel free to submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for browserjquery 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for browserjquery 2.0.1
File Size Uploaded
browserjquery-2.0.1.tar.gz 33.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for browserjquery 2.0.1
File Interpreter ABI Platform
browserjquery-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 67.2 kB

Release files / browserjquery-2.0.1.tar.gz

Download URL browserjquery-2.0.1.tar.gz
Size 33.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f822e39ce61d818dee829bb865bef2df4f34c422f1c27eb827bed90483119ac1
BLAKE2b-256 checksum
How to use checksums
474c33c61ef08b9d36d0194d0e19858e0671478364517062fd9bacb1e277f2ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.13.0 Linux/6.6.87.1-microsoft-standard-WSL2

Release files / browserjquery-2.0.1-py3-none-any.whl

Download URL browserjquery-2.0.1-py3-none-any.whl
Size 33.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f8c4d8fc0944985b234eb378da0ac6ef0c044705e935722819b50d5efc561c2
BLAKE2b-256 checksum
How to use checksums
4736c6309af8cff998216563ab1b249d6c6ce10668bbe3115f3074071e3079ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.13.0 Linux/6.6.87.1-microsoft-standard-WSL2

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page