c165f2f788
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/
3.3 KiB
3.3 KiB
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
// 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
b.Hover(ctx, "#menu-button")
b.Click(ctx, "#dropdown-item")
Double click
b.DoubleClick(ctx, "#file-icon")
Right click
b.RightClick(ctx, "#context-menu-trigger")
Drag and drop
b.DragAndDrop(ctx, "#drag-source", "#drop-target")
Scroll
// 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
// Ctrl+A (Select all)
b.PressKey(ctx, "Control+A")
// Ctrl+C (Copy)
b.PressKey(ctx, "Control+C")
// Esc
b.PressKey(ctx, "Escape")
Action chains
chain := b.NewActionChain()
chain.
MoveTo("#drag-handle").
Click().
MoveTo("#drop-zone").
Release().
Perform(ctx)
CDP Methods
Input.dispatchMouseEventInput.dispatchKeyEventInput.dispatchTouchEventRuntime.evaluatepara 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