Skip to main content

Movva library to create automations.

Project description

movva-tech-library

Uma biblioteca de automação desktop focada em Windows, encapsulando e simplificando as funcionalidades do pywinauto e pyautogui.

Como inicializar

Para utilizar a biblioteca, basta importar e instanciar a classe DesktopRobot:

from movva_tech_library import DesktopRobot
from pathlib import Path

# Instanciando o robô
robot = DesktopRobot()

## Referência de Métodos

### Gerenciamento de Aplicações e Janelas

- **Iniciar uma aplicação:**
  ```python
  robot.start_application(path=r"C:\Caminho\Para\App.exe", backend="uia")
  • Conectar a uma aplicação em execução:

    robot.connect_application(title="Meu App", backend="uia")
    
  • Esperar por uma janela específica:

    robot.wait_for_window(title="Janela Principal", timeout=10)
    
  • Definir janela ativa: (Útil para buscar locators apenas dentro dessa janela)

    robot.set_active_window(title="Janela Principal")
    
  • Encerrar aplicação:

    robot.kill()
    

Interação com Elementos da Interface (Locators pywinauto)

Os métodos abaixo aceitam qualquer critério do pywinauto (ex: title, auto_id, control_type).

  • Clicar por locator:

    robot.click_by_locator(title="Botão Confirmar")
    
  • Duplo clique por locator:

    robot.double_click_by_locator(auto_id="btnDetalhes")
    
  • Obter texto de um elemento:

    texto = robot.get_text(auto_id="labelStatus")
    print(texto)
    

Interação por Imagens na Tela (pyautogui)

Recomenda-se o uso de caminhos absolutos para as imagens.

  • Clicar em uma imagem:

    # Opcional: usar offset_x e offset_y para clicar deslocado do centro da imagem
    image_path = str(BASE_DIR / "assets" / "botao.png")
    robot.click_by_image(image_path, confidence=0.9, timeout=10)
    
  • Esperar por uma imagem aparecer na tela:

    coordenadas = robot.wait_for_image(image_path, confidence=0.9, timeout=10)
    

Teclado e Digitação

  • Digitar texto: Pode focar em um elemento específico antes de digitar caso forneça um locator.

    # Digita livremente onde o cursor estiver
    robot.type_text("Olá Mundo", interval=0.05)
    
    # Foca no input primeiro e depois digita
    robot.type_text("Meu texto direto no campo", locator={"auto_id": "inputTexto"})
    
  • Pressionar teclas isoladas:

    robot.press_key("enter")
    robot.press_key("tab", presses=2)
    
  • Pressionar atalhos (hotkeys):

    robot.hotkey("ctrl", "c")
    robot.hotkey("alt", "f4")
    

Esperas (Timeouts e Pausas)

  • Pausa estática (não recomendado, use waits dinâmicos quando possível):
    robot.wait(2.5) # Aguarda 2.5 segundos
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

movva_tech_library-0.1.4.tar.gz (51.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

movva_tech_library-0.1.4-py3-none-any.whl (121.7 kB view details)

Uploaded Python 3

File details

Details for the file movva_tech_library-0.1.4.tar.gz.

File metadata

  • Download URL: movva_tech_library-0.1.4.tar.gz
  • Upload date:
  • Size: 51.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for movva_tech_library-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ab293a3cbb048b442b3beaae60176c0a742f7337203f977f49d39668f4b1e241
MD5 dcf92f775ba30c43ea7a013bed47843d
BLAKE2b-256 3d424ae5bddd4e6c6224ec81f5a9990150450f2c28bd9620247c1326d5a3ff90

See more details on using hashes here.

Provenance

The following attestation bundles were made for movva_tech_library-0.1.4.tar.gz:

Publisher: release.yml on movva-tech/movva-tech-library

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file movva_tech_library-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for movva_tech_library-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5a5144a19582a95cc11b118064d41e9ded241910e9aa47e0d5b5fb1f93fd24bb
MD5 729310f488bd4370b2c0299e26a71523
BLAKE2b-256 10bac08b8a9557adf1b8bd7a6a3cfb062d48f5a68eaa2df3b9192f6830b4da90

See more details on using hashes here.

Provenance

The following attestation bundles were made for movva_tech_library-0.1.4-py3-none-any.whl:

Publisher: release.yml on movva-tech/movva-tech-library

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page