Skip to content

Commit 0749e8f

Browse files
committed
Feature: Disable Self-Healing for Run Keyword And Return Status
1 parent 3dddf19 commit 0749e8f

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/SelfHealing/SelfHealing.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ def __init__(self, fix="realtime", collect_locator_info = False, use_locator_db
4545
self.fix_realtime = False
4646
self.fix_retry = True
4747
self.locator_info = {}
48-
self.locator_db = LocatorDetailsDB(locator_db_file).db
48+
try:
49+
self.locator_db = LocatorDetailsDB(locator_db_file).db
50+
except:
51+
pass
52+
53+
4954

5055
def _start_library_keyword(self, data, implementation, result):
5156
if self.greedy_fix and data.args:
@@ -70,7 +75,7 @@ def _start_library_keyword(self, data, implementation, result):
7075

7176
def _end_library_keyword(self, data, implementation, result):
7277
# Check if Keyword belongs to Browser Library
73-
if result.owner == 'Browser' and result.failed:
78+
if result.owner == 'Browser' and result.failed and data.parent.name != "Run Keyword And Return Status":
7479
browser = implementation.owner.instance
7580
logger.info(f"Keyword '{result.full_name}' with arguments '{BuiltIn().replace_variables(data.args)}' used on line {data.lineno} failed.", also_console=True)
7681
healer = BrowserHealer(implementation.owner.instance, use_llm_for_locator_proposals = self.use_llm_for_locator_proposals)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
*** Settings ***
2+
Library Browser timeout=5s
3+
Library SelfHealing use_llm_for_locator_proposals=True
4+
Suite Setup New Browser browser=${BROWSER} headless=${HEADLESS}
5+
Test Setup New Context viewport={'width': 1280, 'height': 720}
6+
Test Teardown Close Context
7+
Suite Teardown Close Browser ALL
8+
9+
*** Variables ***
10+
${BROWSER} chromium
11+
${HEADLESS} True
12+
13+
*** Test Cases ***
14+
Login with valid credentials
15+
New Page https://automationintesting.com/selenium/testpage/
16+
Set Browser Timeout 1s
17+
${status} Run Keyword And Return Status Fill Text id=first_name tom
18+
Should Be Equal ${status} ${False}

0 commit comments

Comments
 (0)