Metadata-Version: 2.4
Name: seleasy
Version: 1.1.0
Summary: A simplified Selenium wrapper library with a clean, chainable API for common browser automation tasks.
Author-email: Solitary_Night <3118556179@qq.com>
License-Expression: MIT
Keywords: selenium,browser-automation,web-scraping,webdriver,testing
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: selenium>=4.0.0
Requires-Dist: beautifulsoup4>=4.9.0
Dynamic: license-file

# Seleasy

A simplified Selenium wrapper library with a clean, chainable API for common browser automation tasks. Built on top of Selenium WebDriver and BeautifulSoup4.

## Installation

```bash
pip install seleasy
```

## Quick Start

```python
from seleasy import Seleasy

# Initialize with your preferred browser
es = Seleasy(browser='edge')  # or 'chrome', 'firefox', 'safari'

# Navigate to a URL
es.get('https://www.example.com')

# Wait for and click an element
es.click_element('button', 'text', 'Login', delay=10)

# Type text into an input
es.input_text('input', 'id', 'username', text='myuser')

# Use JavaScript mode when the normal input/click path is intercepted
es.input_text('input', 'id', 'username', text='myuser', use_js=True)
es.click_element('button', 'text', 'Login', use_js=True)

# Scroll the page in fixed increments
es.roll_move('div', 'class', 'content-area', delta_y=400)

# Move the wheel to a target element, including elements far below the viewport
es.roll_to_element('button', 'id', 'submit')

# Get page source
html = es.get_html_source('page.html')

# Parse with BeautifulSoup
soup = es.get_soup()

# Clean up
es.quit()
```

## Features

- **Multi-browser support**: Edge, Chrome, Firefox, Safari
- **Smart element location**: Find elements by tag + attribute + value
- **Auto-wait**: Built-in `WebDriverWait` with configurable timeout
- **Optional JS interactions**: Click or enter text via JavaScript to bypass interception
- **Scroll & hover**: Wheel scrolling, wheel-to-element, smooth scrollIntoView, hover actions
- **iframe management**: Switch into/out of frames with simple API
- **BeautifulSoup integration**: Parse page HTML directly
- **Screenshots & page source**: Save screenshots and HTML with one line

## JavaScript Interaction Mode

`use_js` defaults to `False`, so calls use Selenium's normal browser
interactions unless JavaScript is explicitly requested.

```python
# Normal Selenium click and text input
es.click_element('button', 'id', 'submit')
es.input_text('input', 'id', 'username', text='myuser')

# JavaScript mode
es.click_element('button', 'id', 'submit', use_js=True)
es.input_text('input', 'id', 'username', text='myuser', use_js=True)
```

JavaScript text input uses the native input value setter and dispatches
`input` and `change` events so React, Vue, and other listeners can observe
the new value. It cannot bypass websites that explicitly require trusted
keyboard events.

## Supported Browsers

| Browser  | Argument     |
|----------|-------------|
| Edge     | `'edge'`    |
| Chrome   | `'chrome'`  |
| Firefox  | `'firefox'` |
| Safari   | `'safari'`  |

## Requirements

- Python 3.8+
- selenium >= 4.0.0
- beautifulsoup4 >= 4.9.0
- A matching WebDriver for your browser (managed automatically by Selenium Manager)

## License

MIT
