Query using Jquery on selenium driver.
Project description
BrowserJQuery: Streamline Selenium with jQuery
Enhance your Selenium-driven web automation tasks with BrowserJQuery, a Python package that empowers you to use jQuery effortlessly. This straightforward yet robust package simplifies the execution of jQuery scripts and includes built-in utility methods.
Installation
Get started quickly by installing BrowserJQuery from PyPI:
pip install browserjquery
Usage
Here's how you can harness the power of BrowserJQuery in your Selenium scripts:
import time
from selenium.webdriver import Chrome
from browserjquery import BrowserJQuery
# Initialize a Selenium driver
driver = Chrome()
# Navigate to a website
driver.get("https://www.yahoo.com")
# Pause to allow page loading (you can adjust the duration)
time.sleep(10)
# Create a jQuery object for the driver
jquery = BrowserJQuery(driver)
# Execute a jQuery script
jquery.execute("""return $("div.stream-item")""")
# Use the jQuery object to find and select items
stream = jquery(".stream-item")
# Access methods and attributes of the jQuery object
print(jquery.document)
# Find elements within the selected items
print(jquery.find(".stream-item a"))
# Find elements with specific text
print(jquery.find_elements_with_text("Hello"))
# Find elements with specific text within a specific element
print(jquery.find_elements_with_text("Hello", element=stream[0]))
# Get the parent element of a selected item
print(jquery.parent(stream[0]))
With BrowserJQuery, you can effortlessly integrate jQuery into your Selenium workflows, making web automation more efficient and powerful.
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 Distribution
Built Distribution
File details
Details for the file browserjquery-0.1.1.tar.gz
.
File metadata
- Download URL: browserjquery-0.1.1.tar.gz
- Upload date:
- Size: 30.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.13 Linux/6.2.0-1011-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cb44399d6a96bf5607621d4ddfaa0197a88e4804c223f19f6dfa7ec0a31a7ab |
|
MD5 | a11747b7f4813a0e683391d0465958eb |
|
BLAKE2b-256 | 0a316307dc5cc5205a786118ec37ee35ea0ab8d3dc08f6a7b70e8538a8f2ccc0 |
File details
Details for the file browserjquery-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: browserjquery-0.1.1-py3-none-any.whl
- Upload date:
- Size: 30.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.13 Linux/6.2.0-1011-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70f0d1b1f7b93ee3c299f40eb0cfc8ec20794329c5af64af3e6f9983c0b7868b |
|
MD5 | 20bf2c433715d52f98ceea7920ac80af |
|
BLAKE2b-256 | df1ae2a43da95073047be1663ecca3a208d15228bf414c20487e3d05b75d32ea |