https://github.com/inquilabee/browserjquery
Query using JQuery on selenium driver in Python.
https://github.com/inquilabee/browserjquery
browser-automation browser-jquery python python-automation selenium-python
Last synced: 3 months ago
JSON representation
Query using JQuery on selenium driver in Python.
- Host: GitHub
- URL: https://github.com/inquilabee/browserjquery
- Owner: inquilabee
- License: mit
- Created: 2023-09-14T11:52:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-20T14:00:39.000Z (over 1 year ago)
- Last Synced: 2025-02-24T04:17:43.825Z (3 months ago)
- Topics: browser-automation, browser-jquery, python, python-automation, selenium-python
- Language: Python
- Homepage:
- Size: 129 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```bash
pip install browserjquery
```# Usage
Here's how you can harness the power of **BrowserJQuery** in your Selenium scripts:
```python
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.