docs: issues técnicas para nuevas funcionalidades
Agrega 19 issues técnicas documentando funcionalidades implementadas y pendientes. Issues completadas (movidas a dev/issues/completed/): - 001-conversor-web-markdown.md - 002-accessibility-tree.md - 003-gestion-cookies-perfil.md - 004-gestion-extensiones-chrome.md - 005-eliminar-timeouts-innecesarios.md Issues implementadas: - 006-manejo-tabs-ventanas.md - 016-manejo-iframes.md - 017-actions-api.md - 018-file-uploads.md - 019-expected-conditions-mejoradas.md Issues pendientes (media prioridad): - 007-alert-prompt-confirm-handling.md - 008-screenshot-elementos-especificos.md - 009-pdf-generation.md - 010-device-emulation-completo.md - 011-downloads-handling.md Issues pendientes (baja prioridad / avanzado): - 012-browser-contexts-multi-sesion.md - 013-video-recording.md - 014-network-mocking-avanzado.md - 015-geolocation-permissions.md Incluye también dev/NUEVAS_FUNCIONALIDADES.md con resumen completo. Directorio: dev/
This commit is contained in:
@@ -0,0 +1,137 @@
|
||||
# Issue #017: Actions API - Acciones Complejas
|
||||
|
||||
**Tipo**: Enhancement
|
||||
**Prioridad**: Alta
|
||||
**Estado**: En progreso
|
||||
|
||||
## Descripción
|
||||
|
||||
Implementar API para acciones complejas de mouse y teclado: hover, drag & drop, double click, right click, scroll, etc.
|
||||
|
||||
## Funcionalidad deseada
|
||||
|
||||
### Acciones de Mouse
|
||||
- Hover sobre elemento
|
||||
- Double click
|
||||
- Right click (menú contextual)
|
||||
- Drag and drop
|
||||
- Scroll a posición específica
|
||||
- Scroll a elemento
|
||||
- Move mouse a coordenadas
|
||||
- Mouse down/up separados
|
||||
|
||||
### Acciones de Teclado
|
||||
- Press key (con modificadores)
|
||||
- Hold key
|
||||
- Shortcuts (Ctrl+C, Ctrl+V, etc.)
|
||||
- Combinaciones complejas
|
||||
|
||||
### Cadenas de acciones
|
||||
- Encadenar múltiples acciones
|
||||
- ActionChain pattern (como Selenium)
|
||||
|
||||
## API propuesta
|
||||
|
||||
```go
|
||||
// Mouse actions
|
||||
func (b *Browser) Hover(ctx context.Context, selector string) error
|
||||
func (b *Browser) DoubleClick(ctx context.Context, selector string) error
|
||||
func (b *Browser) RightClick(ctx context.Context, selector string) error
|
||||
func (b *Browser) DragAndDrop(ctx context.Context, sourceSelector, targetSelector string) error
|
||||
func (b *Browser) ScrollTo(ctx context.Context, x, y int) error
|
||||
func (b *Browser) ScrollToElement(ctx context.Context, selector string) error
|
||||
func (b *Browser) ScrollBy(ctx context.Context, x, y int) error
|
||||
func (b *Browser) MoveMouse(ctx context.Context, x, y int) error
|
||||
|
||||
// Keyboard actions
|
||||
func (b *Browser) PressKey(ctx context.Context, key string) error
|
||||
func (b *Browser) HoldKey(ctx context.Context, key string) error
|
||||
func (b *Browser) ReleaseKey(ctx context.Context, key string) error
|
||||
func (b *Browser) SendKeys(ctx context.Context, keys ...string) error
|
||||
|
||||
// Action chains
|
||||
type ActionChain struct {
|
||||
browser *Browser
|
||||
actions []action
|
||||
}
|
||||
|
||||
func (b *Browser) NewActionChain() *ActionChain
|
||||
func (ac *ActionChain) MoveTo(selector string) *ActionChain
|
||||
func (ac *ActionChain) Click() *ActionChain
|
||||
func (ac *ActionChain) DoubleClick() *ActionChain
|
||||
func (ac *ActionChain) ContextClick() *ActionChain
|
||||
func (ac *ActionChain) SendKeys(keys ...string) *ActionChain
|
||||
func (ac *ActionChain) Pause(duration time.Duration) *ActionChain
|
||||
func (ac *ActionChain) Perform(ctx context.Context) error
|
||||
```
|
||||
|
||||
## Uso
|
||||
|
||||
### Hover
|
||||
```go
|
||||
b.Hover(ctx, "#menu-button")
|
||||
b.Click(ctx, "#dropdown-item")
|
||||
```
|
||||
|
||||
### Double click
|
||||
```go
|
||||
b.DoubleClick(ctx, "#file-icon")
|
||||
```
|
||||
|
||||
### Right click
|
||||
```go
|
||||
b.RightClick(ctx, "#context-menu-trigger")
|
||||
```
|
||||
|
||||
### Drag and drop
|
||||
```go
|
||||
b.DragAndDrop(ctx, "#drag-source", "#drop-target")
|
||||
```
|
||||
|
||||
### Scroll
|
||||
```go
|
||||
// Scroll a elemento
|
||||
b.ScrollToElement(ctx, "#footer")
|
||||
|
||||
// Scroll por pixels
|
||||
b.ScrollBy(ctx, 0, 500)
|
||||
|
||||
// Scroll a posición absoluta
|
||||
b.ScrollTo(ctx, 0, 1000)
|
||||
```
|
||||
|
||||
### Shortcuts de teclado
|
||||
```go
|
||||
// Ctrl+A (Select all)
|
||||
b.PressKey(ctx, "Control+A")
|
||||
|
||||
// Ctrl+C (Copy)
|
||||
b.PressKey(ctx, "Control+C")
|
||||
|
||||
// Esc
|
||||
b.PressKey(ctx, "Escape")
|
||||
```
|
||||
|
||||
### Action chains
|
||||
```go
|
||||
chain := b.NewActionChain()
|
||||
chain.
|
||||
MoveTo("#drag-handle").
|
||||
Click().
|
||||
MoveTo("#drop-zone").
|
||||
Release().
|
||||
Perform(ctx)
|
||||
```
|
||||
|
||||
## CDP Methods
|
||||
|
||||
- `Input.dispatchMouseEvent`
|
||||
- `Input.dispatchKeyEvent`
|
||||
- `Input.dispatchTouchEvent`
|
||||
- `Runtime.evaluate` para JavaScript
|
||||
|
||||
## Referencias
|
||||
|
||||
- CDP Input: https://chromedevtools.github.io/devtools-protocol/tot/Input/
|
||||
- Selenium Actions: https://www.selenium.dev/documentation/webdriver/actions_api/
|
||||
- Playwright actions: https://playwright.dev/docs/input
|
||||
Reference in New Issue
Block a user