josias 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ .eggs/
7
+ dist/
8
+ build/
9
+ *.egg
10
+
11
+ # Ambientes virtuais
12
+ .venv/
13
+ venv/
14
+ env/
15
+
16
+ # Testes e cobertura
17
+ .pytest_cache/
18
+ .coverage
19
+ htmlcov/
20
+ .tox/
21
+
22
+ # IDE
23
+ .idea/
24
+ .vscode/
25
+ *.swp
26
+ *.swo
27
+
28
+ # SO
29
+ .DS_Store
30
+ Thumbs.db
31
+
32
+ # Projeto
33
+ examples/output/
34
+ *.log
35
+
36
+ # Build PyPI
37
+ *.whl
38
+ *.tar.gz
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ Todas as mudanças relevantes deste projeto serão documentadas neste arquivo.
4
+
5
+ O formato segue [Keep a Changelog](https://keepachangelog.com/) e o versionamento [SemVer](https://semver.org/).
6
+
7
+ ## [0.1.0] - 2026-06-30
8
+
9
+ ### Adicionado
10
+
11
+ - Classe principal `Josias` com context manager
12
+ - Automação DOM via Selenium com seletores amigáveis
13
+ - Navegação, abas, esperas e interação com iframes
14
+ - Visão computacional: OCR (Tesseract) e detecção de imagem (OpenCV)
15
+ - Executor de tarefas com backtrack inteligente
16
+ - Suporte a Chrome, Firefox e Edge
17
+ - Extras opcionais `[vision]` e `[dev]`
josias-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Josias Automation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
josias-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.4
2
+ Name: josias
3
+ Version: 0.1.0
4
+ Summary: Biblioteca Python de automação web com Selenium e visão computacional.
5
+ Project-URL: Homepage, https://github.com/JosiasAz/josias
6
+ Project-URL: Documentation, https://github.com/JosiasAz/josias#readme
7
+ Project-URL: Repository, https://github.com/JosiasAz/josias
8
+ Project-URL: Issues, https://github.com/JosiasAz/josias/issues
9
+ Project-URL: Changelog, https://github.com/JosiasAz/josias/blob/main/CHANGELOG.md
10
+ Author: Josias Automation
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: automation,computer-vision,josias,ocr,rpa,selenium,web
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Software Development :: Testing
24
+ Requires-Python: >=3.10
25
+ Requires-Dist: numpy>=1.24.0
26
+ Requires-Dist: opencv-python-headless>=4.8.0
27
+ Requires-Dist: pillow>=10.0.0
28
+ Requires-Dist: selenium>=4.15.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: build>=1.0.0; extra == 'dev'
31
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
32
+ Requires-Dist: pytest>=7.4.0; extra == 'dev'
33
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
34
+ Requires-Dist: twine>=4.0.0; extra == 'dev'
35
+ Provides-Extra: vision
36
+ Requires-Dist: pytesseract>=0.3.10; extra == 'vision'
37
+ Description-Content-Type: text/markdown
38
+
39
+ # Josias
40
+
41
+ Biblioteca Python para automação web com **Selenium** e **visão computacional** — simples, limpa e pronta para escalar.
42
+
43
+ Parte do ecossistema **Josias**, uma plataforma completa de automação RPA.
44
+
45
+ ## Instalação
46
+
47
+ ```bash
48
+ pip install josias
49
+
50
+ # Com OCR (requer Tesseract instalado no sistema)
51
+ pip install josias[vision]
52
+
53
+ # Desenvolvimento local
54
+ pip install -e ".[dev,vision]"
55
+ ```
56
+
57
+ ### Pré-requisitos
58
+
59
+ - Python 3.10+
60
+ - Google Chrome, Firefox ou Edge
61
+ - [Tesseract OCR](https://github.com/UB-Mannheim/tesseract/wiki) — necessário apenas para recursos de OCR
62
+
63
+ ## Uso rápido
64
+
65
+ ```python
66
+ from josias import Josias
67
+
68
+ with Josias() as bot:
69
+ bot.open("https://example.com")
70
+
71
+ # DOM — seletores CSS simples
72
+ bot.click("#login")
73
+ bot.type("#email", "usuario@email.com")
74
+ bot.type("#password", "senha123", submit=True)
75
+
76
+ # Esperas
77
+ bot.wait_for("#dashboard")
78
+
79
+ # Visão computacional (OCR + imagem)
80
+ bot.click_text("Confirmar")
81
+ bot.click_image("assets/botao_ok.png")
82
+ ```
83
+
84
+ ## Seletores
85
+
86
+ | Formato | Exemplo | Descrição |
87
+ |---------|---------|-----------|
88
+ | CSS (padrão) | `"#login"`, `".btn"` | Seletor CSS |
89
+ | XPath | `"xpath://button"` | XPath explícito |
90
+ | ID | `"id:username"` | Por atributo id |
91
+ | Texto | `"text:Entrar"` | Por texto visível na página |
92
+
93
+ ## Configuração
94
+
95
+ ```python
96
+ from josias import Josias, Config, VisionConfig
97
+ from josias.types import Browser
98
+
99
+ config = Config(
100
+ browser=Browser.CHROME,
101
+ headless=True,
102
+ window_size=(1920, 1080),
103
+ default_timeout=15.0,
104
+ vision=VisionConfig(
105
+ confidence_threshold=80.0,
106
+ tesseract_lang="por",
107
+ ),
108
+ )
109
+
110
+ with Josias(config) as bot:
111
+ bot.open("https://example.com")
112
+ ```
113
+
114
+ ## Tarefas com backtrack
115
+
116
+ Execute sequências de ações com retry automático entre etapas:
117
+
118
+ ```python
119
+ with Josias() as bot:
120
+ bot.open("https://app.exemplo.com")
121
+
122
+ bot.run([
123
+ {"text": "Login", "sendtext": "usuario", "backtrack": True},
124
+ {"text": "Senha", "sendtext": "123456", "backtrack": True},
125
+ {"image": "submit.png", "backtrack": True, "confidence": 0.9},
126
+ ])
127
+ ```
128
+
129
+ ## Arquitetura
130
+
131
+ ```
132
+ src/josias/
133
+ ├── bot.py # Classe principal
134
+ ├── config.py # Configuração centralizada
135
+ ├── browser/ # Gerenciamento Selenium
136
+ ├── dom/ # Seletores e interação DOM
137
+ ├── vision/ # OCR e detecção de imagem
138
+ ├── actions/ # Mouse, teclado e tarefas
139
+ └── waits.py # Esperas explícitas
140
+ ```
141
+
142
+ ## Publicação no PyPI
143
+
144
+ ```bash
145
+ python -m build
146
+ python -m twine check dist/*
147
+ python -m twine upload dist/*
148
+ ```
149
+
150
+ Ou crie uma **Release** no GitHub — o workflow publica automaticamente via Trusted Publishing.
151
+
152
+ ## Roadmap
153
+
154
+ - [x] Core Selenium com API simplificada
155
+ - [x] Visão computacional (OCR + imagem)
156
+ - [x] Executor de tarefas com backtrack
157
+ - [ ] Orquestrador Josias
158
+ - [ ] Plugins (Excel, AWS, e-mail)
159
+ - [ ] CLI e deploy de bots
160
+
161
+ ## Licença
162
+
163
+ MIT — veja [LICENSE](LICENSE).
josias-0.1.0/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # Josias
2
+
3
+ Biblioteca Python para automação web com **Selenium** e **visão computacional** — simples, limpa e pronta para escalar.
4
+
5
+ Parte do ecossistema **Josias**, uma plataforma completa de automação RPA.
6
+
7
+ ## Instalação
8
+
9
+ ```bash
10
+ pip install josias
11
+
12
+ # Com OCR (requer Tesseract instalado no sistema)
13
+ pip install josias[vision]
14
+
15
+ # Desenvolvimento local
16
+ pip install -e ".[dev,vision]"
17
+ ```
18
+
19
+ ### Pré-requisitos
20
+
21
+ - Python 3.10+
22
+ - Google Chrome, Firefox ou Edge
23
+ - [Tesseract OCR](https://github.com/UB-Mannheim/tesseract/wiki) — necessário apenas para recursos de OCR
24
+
25
+ ## Uso rápido
26
+
27
+ ```python
28
+ from josias import Josias
29
+
30
+ with Josias() as bot:
31
+ bot.open("https://example.com")
32
+
33
+ # DOM — seletores CSS simples
34
+ bot.click("#login")
35
+ bot.type("#email", "usuario@email.com")
36
+ bot.type("#password", "senha123", submit=True)
37
+
38
+ # Esperas
39
+ bot.wait_for("#dashboard")
40
+
41
+ # Visão computacional (OCR + imagem)
42
+ bot.click_text("Confirmar")
43
+ bot.click_image("assets/botao_ok.png")
44
+ ```
45
+
46
+ ## Seletores
47
+
48
+ | Formato | Exemplo | Descrição |
49
+ |---------|---------|-----------|
50
+ | CSS (padrão) | `"#login"`, `".btn"` | Seletor CSS |
51
+ | XPath | `"xpath://button"` | XPath explícito |
52
+ | ID | `"id:username"` | Por atributo id |
53
+ | Texto | `"text:Entrar"` | Por texto visível na página |
54
+
55
+ ## Configuração
56
+
57
+ ```python
58
+ from josias import Josias, Config, VisionConfig
59
+ from josias.types import Browser
60
+
61
+ config = Config(
62
+ browser=Browser.CHROME,
63
+ headless=True,
64
+ window_size=(1920, 1080),
65
+ default_timeout=15.0,
66
+ vision=VisionConfig(
67
+ confidence_threshold=80.0,
68
+ tesseract_lang="por",
69
+ ),
70
+ )
71
+
72
+ with Josias(config) as bot:
73
+ bot.open("https://example.com")
74
+ ```
75
+
76
+ ## Tarefas com backtrack
77
+
78
+ Execute sequências de ações com retry automático entre etapas:
79
+
80
+ ```python
81
+ with Josias() as bot:
82
+ bot.open("https://app.exemplo.com")
83
+
84
+ bot.run([
85
+ {"text": "Login", "sendtext": "usuario", "backtrack": True},
86
+ {"text": "Senha", "sendtext": "123456", "backtrack": True},
87
+ {"image": "submit.png", "backtrack": True, "confidence": 0.9},
88
+ ])
89
+ ```
90
+
91
+ ## Arquitetura
92
+
93
+ ```
94
+ src/josias/
95
+ ├── bot.py # Classe principal
96
+ ├── config.py # Configuração centralizada
97
+ ├── browser/ # Gerenciamento Selenium
98
+ ├── dom/ # Seletores e interação DOM
99
+ ├── vision/ # OCR e detecção de imagem
100
+ ├── actions/ # Mouse, teclado e tarefas
101
+ └── waits.py # Esperas explícitas
102
+ ```
103
+
104
+ ## Publicação no PyPI
105
+
106
+ ```bash
107
+ python -m build
108
+ python -m twine check dist/*
109
+ python -m twine upload dist/*
110
+ ```
111
+
112
+ Ou crie uma **Release** no GitHub — o workflow publica automaticamente via Trusted Publishing.
113
+
114
+ ## Roadmap
115
+
116
+ - [x] Core Selenium com API simplificada
117
+ - [x] Visão computacional (OCR + imagem)
118
+ - [x] Executor de tarefas com backtrack
119
+ - [ ] Orquestrador Josias
120
+ - [ ] Plugins (Excel, AWS, e-mail)
121
+ - [ ] CLI e deploy de bots
122
+
123
+ ## Licença
124
+
125
+ MIT — veja [LICENSE](LICENSE).
@@ -0,0 +1,23 @@
1
+ """Exemplo 1 — Automação web básica com DOM (Selenium)."""
2
+
3
+ from josias import Josias
4
+
5
+
6
+ def main() -> None:
7
+ with Josias() as bot:
8
+ bot.open("https://example.com")
9
+
10
+ # Verifica título da página
11
+ print(f"Título: {bot.title}")
12
+
13
+ # Interação via seletores CSS (padrão)
14
+ heading = bot.get_text("h1")
15
+ print(f"Cabeçalho: {heading}")
16
+
17
+ # Navegação
18
+ bot.open("https://example.com")
19
+ bot.wait(1)
20
+
21
+
22
+ if __name__ == "__main__":
23
+ main()
@@ -0,0 +1,37 @@
1
+ """Exemplo 2 — Automação DOM completa (formulários, esperas, seletores)."""
2
+
3
+ from josias import Config, Josias
4
+ from josias.types import Browser
5
+
6
+
7
+ def main() -> None:
8
+ config = Config(
9
+ browser=Browser.CHROME,
10
+ headless=False,
11
+ default_timeout=15.0,
12
+ )
13
+
14
+ with Josias(config) as bot:
15
+ bot.open("https://www.selenium.dev/selenium/web/web-form.html")
16
+
17
+ # Seletores CSS (padrão)
18
+ bot.type("#my-text-id", "Josias Automation")
19
+ bot.type("input[name='my-password']", "senha123")
20
+
21
+ # Dropdown
22
+ bot.click("select[name='my-select']")
23
+ bot.click("option[value='2']")
24
+
25
+ # Checkbox
26
+ bot.click("input[type='checkbox']")
27
+
28
+ # Submit
29
+ bot.click("button")
30
+
31
+ # Espera mensagem de sucesso
32
+ bot.wait_for("#message")
33
+ print(f"Resultado: {bot.get_text('#message')}")
34
+
35
+
36
+ if __name__ == "__main__":
37
+ main()
@@ -0,0 +1,41 @@
1
+ """Exemplo 3 — Automação com visão computacional (OCR + imagem)."""
2
+
3
+ from josias import Config, Josias, VisionConfig
4
+
5
+
6
+ def main() -> None:
7
+ config = Config(
8
+ headless=False,
9
+ vision=VisionConfig(
10
+ confidence_threshold=75.0,
11
+ tesseract_lang="eng",
12
+ ),
13
+ )
14
+
15
+ with Josias(config) as bot:
16
+ bot.open("https://example.com")
17
+
18
+ # OCR — encontra e clica em texto visível na página
19
+ if bot.click_text("Learn more"):
20
+ print("Clicou em 'Learn more' via OCR")
21
+ else:
22
+ print("Texto não encontrado via OCR")
23
+
24
+ # Screenshot para debug
25
+ bot.screenshot("examples/output/example.png")
26
+ print("Screenshot salvo em examples/output/example.png")
27
+
28
+ # Lista de tarefas com backtrack
29
+ bot.start_task_session()
30
+ results = bot.run(
31
+ [
32
+ {"text": "Example", "backtrack": True, "delay": 1},
33
+ {"text": "Domain", "backtrack": True, "delay": 1},
34
+ ]
35
+ )
36
+ ok, total = bot.end_task_session()
37
+ print(f"Tarefas: {results} | Sessão: {ok}/{total}")
38
+
39
+
40
+ if __name__ == "__main__":
41
+ main()
@@ -0,0 +1,71 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "josias"
7
+ version = "0.1.0"
8
+ description = "Biblioteca Python de automação web com Selenium e visão computacional."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.10"
13
+ authors = [{ name = "Josias Automation" }]
14
+ keywords = ["automation", "selenium", "rpa", "web", "ocr", "computer-vision", "josias"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Topic :: Software Development :: Testing",
25
+ "Topic :: Software Development :: Libraries :: Python Modules",
26
+ ]
27
+ dependencies = [
28
+ "selenium>=4.15.0",
29
+ "pillow>=10.0.0",
30
+ "opencv-python-headless>=4.8.0",
31
+ "numpy>=1.24.0",
32
+ ]
33
+
34
+ [project.optional-dependencies]
35
+ vision = ["pytesseract>=0.3.10"]
36
+ dev = [
37
+ "pytest>=7.4.0",
38
+ "pytest-cov>=4.1.0",
39
+ "ruff>=0.1.0",
40
+ "build>=1.0.0",
41
+ "twine>=4.0.0",
42
+ ]
43
+
44
+ [project.urls]
45
+ Homepage = "https://github.com/JosiasAz/josias"
46
+ Documentation = "https://github.com/JosiasAz/josias#readme"
47
+ Repository = "https://github.com/JosiasAz/josias"
48
+ Issues = "https://github.com/JosiasAz/josias/issues"
49
+ Changelog = "https://github.com/JosiasAz/josias/blob/main/CHANGELOG.md"
50
+
51
+ [tool.hatch.build.targets.wheel]
52
+ packages = ["src/josias"]
53
+
54
+ [tool.hatch.build.targets.sdist]
55
+ only-include = [
56
+ "src/josias",
57
+ "examples",
58
+ "tests",
59
+ "README.md",
60
+ "LICENSE",
61
+ "CHANGELOG.md",
62
+ "pyproject.toml",
63
+ ]
64
+
65
+ [tool.pytest.ini_options]
66
+ testpaths = ["tests"]
67
+ pythonpath = ["src"]
68
+
69
+ [tool.ruff]
70
+ line-length = 100
71
+ target-version = "py310"
@@ -0,0 +1,40 @@
1
+ """
2
+ Josias — Automação web com Selenium e visão computacional.
3
+
4
+ Uso rápido::
5
+
6
+ from josias import Josias
7
+
8
+ with Josias() as bot:
9
+ bot.open("https://example.com")
10
+ bot.click("#login")
11
+ bot.type("#email", "user@email.com")
12
+ bot.click_text("Entrar")
13
+ """
14
+
15
+ from .bot import Josias
16
+ from .config import Config, VisionConfig
17
+ from .exceptions import (
18
+ BrowserNotStartedError,
19
+ ElementNotFoundError,
20
+ JosiasError,
21
+ TaskExecutionError,
22
+ VisionNotAvailableError,
23
+ )
24
+ from .types import Browser, MatchResult, Region, SelectorType
25
+
26
+ __version__ = "0.1.0"
27
+ __all__ = [
28
+ "Josias",
29
+ "Config",
30
+ "VisionConfig",
31
+ "Browser",
32
+ "Region",
33
+ "MatchResult",
34
+ "SelectorType",
35
+ "JosiasError",
36
+ "BrowserNotStartedError",
37
+ "ElementNotFoundError",
38
+ "VisionNotAvailableError",
39
+ "TaskExecutionError",
40
+ ]
@@ -0,0 +1,6 @@
1
+ """Ações de alto nível."""
2
+
3
+ from .mouse import KeyboardActions, MouseActions
4
+ from .tasks import TaskRunner
5
+
6
+ __all__ = ["KeyboardActions", "MouseActions", "TaskRunner"]
@@ -0,0 +1,105 @@
1
+ """Ações de mouse e teclado no navegador."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from selenium.webdriver.common.action_chains import ActionChains
6
+ from selenium.webdriver.common.by import By
7
+ from selenium.webdriver.common.keys import Keys
8
+ from selenium.webdriver.remote.webdriver import WebDriver
9
+
10
+
11
+ class MouseActions:
12
+ """Cliques por coordenada na viewport do navegador."""
13
+
14
+ def __init__(self, driver: WebDriver) -> None:
15
+ self._driver = driver
16
+ self._x = 0
17
+ self._y = 0
18
+
19
+ def _move_to(self, x: int, y: int) -> None:
20
+ mx = x - self._x
21
+ my = y - self._y
22
+ self._x = x
23
+ self._y = y
24
+
25
+ scale = self._driver.execute_script("return window.devicePixelRatio") or 1
26
+ ActionChains(self._driver).move_by_offset(mx / scale, my / scale).perform()
27
+
28
+ def move_to(self, x: int, y: int) -> None:
29
+ self._move_to(x, y)
30
+
31
+ def click_at(
32
+ self,
33
+ x: int,
34
+ y: int,
35
+ *,
36
+ button: str = "left",
37
+ clicks: int = 1,
38
+ ) -> None:
39
+ self._move_to(x, y)
40
+ chain = ActionChains(self._driver)
41
+ for _ in range(clicks):
42
+ if button == "right":
43
+ chain.context_click()
44
+ elif button == "double":
45
+ chain.double_click()
46
+ else:
47
+ chain.click()
48
+ chain.perform()
49
+
50
+ def click_center(self, x: int, y: int, width: int, height: int, **kwargs) -> None:
51
+ cx = x + width // 2
52
+ cy = y + height // 2
53
+ self.click_at(cx, cy, **kwargs)
54
+
55
+ def reset_position(self) -> None:
56
+ self._x = 0
57
+ self._y = 0
58
+
59
+
60
+ class KeyboardActions:
61
+ """Digitação e atalhos de teclado."""
62
+
63
+ def __init__(self, driver: WebDriver) -> None:
64
+ self._driver = driver
65
+
66
+ def type_text(self, text: str, *, interval: float = 0.0) -> None:
67
+ body = self._driver.find_element(By.TAG_NAME, "body")
68
+ for char in text:
69
+ body.send_keys(char)
70
+ if interval > 0:
71
+ import time
72
+
73
+ time.sleep(interval)
74
+
75
+ def send_keys(self, *keys) -> None:
76
+ body = self._driver.find_element(By.TAG_NAME, "body")
77
+ body.send_keys(*keys)
78
+
79
+ def shortcut(self, combo: str) -> None:
80
+ """Executa atalho como ``Ctrl+S`` ou ``Alt+Tab``."""
81
+ parts = [p.strip() for p in combo.split("+")]
82
+ modifiers = {
83
+ "ctrl": Keys.CONTROL,
84
+ "control": Keys.CONTROL,
85
+ "alt": Keys.ALT,
86
+ "shift": Keys.SHIFT,
87
+ "meta": Keys.META,
88
+ "cmd": Keys.META,
89
+ }
90
+ chain = ActionChains(self._driver)
91
+ pressed = []
92
+ for part in parts[:-1]:
93
+ key = modifiers.get(part.lower())
94
+ if key:
95
+ chain.key_down(key)
96
+ pressed.append(key)
97
+ last = parts[-1].lower()
98
+ if last in modifiers:
99
+ chain.key_down(modifiers[last])
100
+ pressed.append(modifiers[last])
101
+ else:
102
+ chain.send_keys(parts[-1])
103
+ for key in reversed(pressed):
104
+ chain.key_up(key)
105
+ chain.perform()