Skip to main content

A Python library for using jQuery with Selenium WebDriver

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

browserjquery-2.0.0.tar.gz (33.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

browserjquery-2.0.0-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

Details for the file browserjquery-2.0.0.tar.gz.

File metadata

  • Download URL: browserjquery-2.0.0.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.0 Linux/6.6.87.1-microsoft-standard-WSL2

File hashes

Hashes for browserjquery-2.0.0.tar.gz
Algorithm Hash digest
SHA256 529026b56263399e6c320cad061f99581ff3b81cd9bf316e00f11c52518e4d65
MD5 a7e6e4578c640eba2a86703dac70192f
BLAKE2b-256 c6780e80de7a1c880a92f68757eed7b1090b11383a5528dd83ff45c2fd5855e3

See more details on using hashes here.

File details

Details for the file browserjquery-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: browserjquery-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 33.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.0 Linux/6.6.87.1-microsoft-standard-WSL2

File hashes

Hashes for browserjquery-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d6242ef05deebb55d93eeeb81e746e9fcb05b241779104976985464a538ab30
MD5 3c60fc5f3876cca92be44cbc973d1fb4
BLAKE2b-256 122577fa28b511fef3df6d5654abb9fad0c71dadaf243efc8e281b1e5a27b363

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page