# robotframework-heal
A Robot Framework Listener for library agnostic self-healing and smart recovery of tests
📙 [Documentation](https://manykarim.github.io/robotframework-heal/) can be found [here](https://manykarim.github.io/robotframework-heal/)
## Installation
```bash
pip install robotframework-heal
```
## Usage
Add `Library SelfHealing ` to your Robot Framework test suite `*** Settings ***` section.
```robotframework
*** Settings ***
Library SelfHealing
```
Set up the following environment variables to enable the self-healing feature:
* `LLM_API_KEY`
* `LLM_API_BASE`
* `LLM_TEXT_MODEL` (model used for picking final locator from proposal list)
* `LLM_LOCATOR_MODEL` (model for generating locator proposals from DOM tree)
* `LLM_VISION_MODEL` (not working yet)
Interface with LLMs uses the [LiteLMM](https://docs.litellm.ai) API.
Check the list of available [Providers](https://docs.litellm.ai/docs/providers) and how to connect to them.
```robotframework
*** Settings ***
Library Browser timeout=5s
Library SelfHealing use_llm_for_locator_proposals=True
Suite Setup New Browser browser=${BROWSER} headless=${HEADLESS}
Test Setup New Context viewport={'width': 1280, 'height': 720}
Test Teardown Close Context
Suite Teardown Close Browser ALL
*** Variables ***
${BROWSER} chromium
${HEADLESS} True
*** Test Cases ***
Login with valid credentials
New Page https://the-internet.herokuapp.com/login
Fill Text id=user tomsmith
Fill Text id=pass SuperSecretPassword!
Click id=loginbutton
Get Text id=flash *= You logged into a secure area!
```
## Arguments
* `fix`: Specifies the mode of operation, set to "realtime" for real-time healing. Default is "realtime".
* `collect_locator_info`: Boolean flag to enable or disable the collection of locator information. Default is false.
* `use_locator_db`: Boolean flag to enable or disable the use of a locator database. Default is false.
* `use_llm_for_locator_proposals`: Boolean flag to enable or disable the use of a language model for generating locator proposals. Default is false.
* `heal_assertions`: Boolean flag to enable or disable the healing of assertions. Default is false. (not implemented yet)
* `locator_db_file`: Specifies the filename for the locator database. Default is "locator_db.json".
## Environment Variables
Example when running with Ollama LLM:
```bash
LLM_API_BASE=http://localhost:11434
LLM_TEXT_MODEL=ollama_chat/llama3.1
LLM_LOCATOR_MODEL=ollama_chat/llama3.1
LLM_VISION_MODEL=ollama_chat/llama3.2-vision
```
Example when using OpenAI:
```bash
LLM_API_KEY=YOUR_OPENAI_API_KEY
LLM_TEXT_MODEL=gpt-3.5-turbo
LLM_LOCATOR_MODEL=gpt-3.5-turbo
```
## Open the project in Gitpod.io
[](https://gitpod.io/#https://github.com/manykarim/robotframework-heal)
Try it out in [Gitpod](https://gitpod.io/#https://github.com/manykarim/robotframework-heal)
## Short URL and QR Code
https://tinyurl.com/robot-heal

Raw data
{
"_id": null,
"home_page": "https://github.com/manykarim/robotframework-heal",
"name": "robotframework-heal",
"maintainer": "Many Kasiriha",
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": "many.kasiriha@dbschenker.com",
"keywords": null,
"author": "Many Kasiriha",
"author_email": "many.kasiriha@dbschenker.com",
"download_url": "https://files.pythonhosted.org/packages/18/0a/2ce9a55fc8ae8bf75e75b8b5f807f3bdc05ba01d3789b73e961baea31476/robotframework_heal-0.2.1.tar.gz",
"platform": null,
"description": "# robotframework-heal\nA Robot Framework Listener for library agnostic self-healing and smart recovery of tests\n\n\ud83d\udcd9 [Documentation](https://manykarim.github.io/robotframework-heal/) can be found [here](https://manykarim.github.io/robotframework-heal/)\n\n## Installation\n```bash\npip install robotframework-heal\n```\n\n## Usage\n\nAdd `Library SelfHealing ` to your Robot Framework test suite `*** Settings ***` section.\n\n```robotframework\n*** Settings ***\nLibrary SelfHealing\n```\t\n\nSet up the following environment variables to enable the self-healing feature:\n\n* `LLM_API_KEY`\n* `LLM_API_BASE`\n* `LLM_TEXT_MODEL` (model used for picking final locator from proposal list)\n* `LLM_LOCATOR_MODEL` (model for generating locator proposals from DOM tree)\n* `LLM_VISION_MODEL` (not working yet)\n\nInterface with LLMs uses the [LiteLMM](https://docs.litellm.ai) API. \nCheck the list of available [Providers](https://docs.litellm.ai/docs/providers) and how to connect to them. \n\n```robotframework\n*** Settings ***\nLibrary Browser timeout=5s\nLibrary SelfHealing use_llm_for_locator_proposals=True\nSuite Setup New Browser browser=${BROWSER} headless=${HEADLESS}\nTest Setup New Context viewport={'width': 1280, 'height': 720}\nTest Teardown Close Context\nSuite Teardown Close Browser ALL\n\n*** Variables ***\n${BROWSER} chromium\n${HEADLESS} True\n\n*** Test Cases ***\nLogin with valid credentials\n New Page https://the-internet.herokuapp.com/login\n Fill Text id=user tomsmith\n Fill Text id=pass SuperSecretPassword!\n Click id=loginbutton\n Get Text id=flash *= You logged into a secure area!\n```\n\n## Arguments\n\n* `fix`: Specifies the mode of operation, set to \"realtime\" for real-time healing. Default is \"realtime\".\n* `collect_locator_info`: Boolean flag to enable or disable the collection of locator information. Default is false.\n* `use_locator_db`: Boolean flag to enable or disable the use of a locator database. Default is false.\n* `use_llm_for_locator_proposals`: Boolean flag to enable or disable the use of a language model for generating locator proposals. Default is false.\n* `heal_assertions`: Boolean flag to enable or disable the healing of assertions. Default is false. (not implemented yet)\n* `locator_db_file`: Specifies the filename for the locator database. Default is \"locator_db.json\".\n\n## Environment Variables\n\nExample when running with Ollama LLM:\n\n```bash\nLLM_API_BASE=http://localhost:11434\nLLM_TEXT_MODEL=ollama_chat/llama3.1\nLLM_LOCATOR_MODEL=ollama_chat/llama3.1\nLLM_VISION_MODEL=ollama_chat/llama3.2-vision\n```\n\nExample when using OpenAI:\n\n```bash\nLLM_API_KEY=YOUR_OPENAI_API_KEY\nLLM_TEXT_MODEL=gpt-3.5-turbo\nLLM_LOCATOR_MODEL=gpt-3.5-turbo\n```\n\n## Open the project in Gitpod.io\n[](https://gitpod.io/#https://github.com/manykarim/robotframework-heal) \nTry it out in [Gitpod](https://gitpod.io/#https://github.com/manykarim/robotframework-heal)\n\n## Short URL and QR Code\n\nhttps://tinyurl.com/robot-heal\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "A Robot Framework Listener for library agnostic self-healing and smart recovery of tests",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/manykarim/robotframework-heal"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "29f4a391473503bd4f252478a2ede1fed43f067e866454caee88e5f474a64f72",
"md5": "a7294f19caa64b19c71385e8a5ea1774",
"sha256": "c957a562f6c6b103ae9253a04d658f797c23e29c107ee61c84182ad2c8d755a8"
},
"downloads": -1,
"filename": "robotframework_heal-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a7294f19caa64b19c71385e8a5ea1774",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 33398,
"upload_time": "2025-02-11T23:32:55",
"upload_time_iso_8601": "2025-02-11T23:32:55.132569Z",
"url": "https://files.pythonhosted.org/packages/29/f4/a391473503bd4f252478a2ede1fed43f067e866454caee88e5f474a64f72/robotframework_heal-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "180a2ce9a55fc8ae8bf75e75b8b5f807f3bdc05ba01d3789b73e961baea31476",
"md5": "d0b1b6eef31a9f401537b43de18c644f",
"sha256": "96343ffeaf2e774a8547986ab56e9cd7e5a7c5a5a30d68da3137ca3ebe2150dd"
},
"downloads": -1,
"filename": "robotframework_heal-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "d0b1b6eef31a9f401537b43de18c644f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 30814,
"upload_time": "2025-02-11T23:32:57",
"upload_time_iso_8601": "2025-02-11T23:32:57.429329Z",
"url": "https://files.pythonhosted.org/packages/18/0a/2ce9a55fc8ae8bf75e75b8b5f807f3bdc05ba01d3789b73e961baea31476/robotframework_heal-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-11 23:32:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "manykarim",
"github_project": "robotframework-heal",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "robotframework-heal"
}